mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Remove unnecessary context storage APIs
and rename context storage APIs
This commit is contained in:
@@ -180,17 +180,17 @@ function createContext(id,seed) {
|
||||
obj.getAsync = function(key) {
|
||||
var keyPath = parseKey(key);
|
||||
var context = getContextStorage(keyPath.storage);
|
||||
return context.getAsync(scope, keyPath.key);
|
||||
return context.get(scope, keyPath.key);
|
||||
};
|
||||
obj.setAsync = function(key, value) {
|
||||
var keyPath = parseKey(key);
|
||||
var context = getContextStorage(keyPath.storage);
|
||||
return context.setAsync(scope, keyPath.key, value);
|
||||
return context.set(scope, keyPath.key, value);
|
||||
};
|
||||
obj.keysAsync = function(storage) {
|
||||
var storageName = parseStorage(storage);
|
||||
var context = getContextStorage(storageName);
|
||||
return context.keysAsync(scope);
|
||||
return context.keys(scope);
|
||||
};
|
||||
return obj;
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ LocalFileSystem.prototype.close = function(){
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
LocalFileSystem.prototype.getAsync = function(scope, key) {
|
||||
LocalFileSystem.prototype.get = function(scope, key) {
|
||||
var storagePath = getStoragePath(this.storageBaseDir ,scope);
|
||||
return loadFile(storagePath + ".json").then(function(data){
|
||||
if(data){
|
||||
@@ -99,7 +99,7 @@ LocalFileSystem.prototype.getAsync = function(scope, key) {
|
||||
});
|
||||
};
|
||||
|
||||
LocalFileSystem.prototype.setAsync =function(scope, key, value) {
|
||||
LocalFileSystem.prototype.set =function(scope, key, value) {
|
||||
var storagePath = getStoragePath(this.storageBaseDir ,scope);
|
||||
return loadFile(storagePath + ".json").then(function(data){
|
||||
var obj = data ? JSON.parse(data) : {}
|
||||
@@ -113,7 +113,7 @@ LocalFileSystem.prototype.setAsync =function(scope, key, value) {
|
||||
});
|
||||
};
|
||||
|
||||
LocalFileSystem.prototype.keysAsync = function(scope){
|
||||
LocalFileSystem.prototype.keys = function(scope){
|
||||
var storagePath = getStoragePath(this.storageBaseDir ,scope);
|
||||
return loadFile(storagePath + ".json").then(function(data){
|
||||
if(data){
|
||||
|
@@ -55,18 +55,6 @@ Memory.prototype.keys = function(scope){
|
||||
}
|
||||
};
|
||||
|
||||
Memory.prototype.getAsync = function(scope, key) {
|
||||
return Promise.resolve(this.get(scope, key));
|
||||
};
|
||||
|
||||
Memory.prototype.setAsync =function(scope, key, value) {
|
||||
return Promise.resolve(this.set(scope, key, value));
|
||||
};
|
||||
|
||||
Memory.prototype.keysAsync = function(scope){
|
||||
return Promise.resolve(this.keys(scope));
|
||||
};
|
||||
|
||||
Memory.prototype.delete = function(scope){
|
||||
delete this.data[scope];
|
||||
return Promise.resolve();
|
||||
|
Reference in New Issue
Block a user