Add open/close API for context

This commit is contained in:
HirokiUchikawa
2018-05-30 10:24:27 +09:00
parent 28d05e2449
commit 7185bcd51f
8 changed files with 318 additions and 260 deletions

View File

@@ -17,11 +17,10 @@
var JsonDB = require('node-json-db');
var fs = require('fs-extra');
var path = require("path");
var when = require("when");
function createStorage(storageBaseDir, scope) {
var i = scope.indexOf(":")
if(i === -1){
if(scope.indexOf(":") === -1){
if(scope === "global"){
return new JsonDB(path.join(storageBaseDir,"global",scope), true, true);
}else{ // scope:flow
@@ -69,6 +68,14 @@ function LocalFileSystem(config){
this.storages = {};
}
LocalFileSystem.prototype.open = function(){
return when.resolve();
}
LocalFileSystem.prototype.close = function(){
return when.resolve();
}
LocalFileSystem.prototype.get = function (scope, key) {
if(!this.storages[scope]){
return undefined;