Commit ffce55f4 authored by Tristan Cavelier's avatar Tristan Cavelier

Add JIO storage environments

Storages are now able to keep some vars in memory in their own environment.
For instance, if the storage tree is revision + local, "revision" will have an
environment and "local" will have another one.
For the futur "replicate revision storage", the environment will contain objects
in order to get the good revision for the good substorage.
Of course, if there are several "replicate revision storage", every one will have
its own environment.
parent c82e766a
......@@ -7,6 +7,8 @@
priv.storage_spec = spec;
priv.environments = {};
// initialize //
priv.init = function() {
// Initialize the jio id and add the new id to the list
......@@ -38,9 +40,14 @@
Object.defineProperty(that,"storage",{
configurable:false,enumerable:false,writable:false,value:
function(spec, my, forcetype) {
var spec_str;
spec = spec || {};
my = my || {};
my.basicStorage = storage;
spec_str = JSON.stringify(spec);
// environment initialization
priv.environments[spec_str] = priv.environments[spec_str] || {};
my.env = priv.environments[spec_str];
my.storage = that.storage; // NOTE : or proxy storage
var type = forcetype || spec.type || 'base';
if (type === 'base') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment