vulpes
Version:
Job management framework
107 lines (88 loc) • 3.13 kB
JavaScript
;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var objectStream = require("@kiosked/object-stream");
/**
* Storage base class
* Provides a storage mechanism for the job handling framework,
* allowing jobs to persist between restarts. This is an
* interface and does not actually perform any operations.
* @memberof module:Vulpes
*/
var Storage = function () {
function Storage() {
_classCallCheck(this, Storage);
}
_createClass(Storage, [{
key: "getItem",
/**
* Get an item by its key
* @param {String} key The key to fetch
* @returns {Promise.<*|null>} A promise that resolves with the item, or
* null if the item doesn't exist
* @memberof Storage
*/
value: function getItem(key) {
return Promise.resolve(null);
}
/**
* Initialise the storage
* This usually entails reading the store from the storage so that it is
* immediately available
* @returns {Promise} A promise that resolves once initialisation has
* completed
* @memberof Storage
*/
}, {
key: "initialise",
value: function initialise() {
return Promise.resolve();
}
/**
* Remove an item from storage
* @param {String} key The key to remove
* @returns {Promise} A promise that resolves once the key has been removed
* @memberof Storage
*/
}, {
key: "removeItem",
value: function removeItem(key) {
return Promise.resolve();
}
/**
* Set an item
* @param {String} key The key to set the value for
* @param {*} value The value to set
* @returns {Promise} A promise that resolves once the value has been
* stored
* @memberof Storage
*/
}, {
key: "setItem",
value: function setItem(key, value) {
return Promise.resolve();
}
/**
* Shutdown the storage instance
* @returns {Promise} A promise that resolves once the shutdown procedure is complete
* @memberof Storage
*/
}, {
key: "shutdown",
value: function shutdown() {
return Promise.resolve();
}
/**
* Stream all items
* @returns {Promise.<ReadableStream>} A promise that resolves with the readable stream
* @memberof Storage
*/
}, {
key: "streamItems",
value: function streamItems() {
return Promise.resolve(objectStream.fromArray([]));
}
}]);
return Storage;
}();
module.exports = Storage;