You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0 KiB

  1. var nThen = require("nthen");
  2. var Tasks = require("../lib/storage/tasks");
  3. var Logger = require("../lib/log");
  4. var config = require("../lib/load-config");
  5. var FileStorage = require('../lib/storage/file');
  6. nThen(function (w) {
  7. Logger.create(config, w(function (_log) {
  8. config.log = _log;
  9. }));
  10. }).nThen(function (w) {
  11. FileStorage.create(config, w(function (_store) {
  12. config.store = _store;
  13. // config.taskPath
  14. // config.store
  15. // config.filePath
  16. // config.blobPath
  17. // config.coldPath
  18. // config.enableTaskScheduling
  19. }));
  20. }).nThen(function (w) {
  21. Tasks.create(config, w(function (err, _tasks) {
  22. if (err) {
  23. throw err;
  24. }
  25. config.tasks = _tasks;
  26. }));
  27. }).nThen(function (w) {
  28. config.tasks.runAll(w(function (err) {
  29. if (err) {
  30. // either TASK_CONCURRENCY
  31. // or an error from tasks.list
  32. }
  33. }));
  34. }).nThen(function () {
  35. config.store.shutdown();
  36. config.log.shutdown();
  37. });