diff --git a/lib/rfs.js b/lib/rfs.js index 7473f258..6ed7d131 100644 --- a/lib/rfs.js +++ b/lib/rfs.js @@ -3,7 +3,13 @@ function Store(opt){ opt.log = opt.log || console.log; opt.file = String(opt.file || 'radata'); var fs = require('fs'), u; + var store = function Store(){}; + if(Store[opt.file]){ + console.log("Warning: reusing same fs store and options as 1st."); + return Store[opt.file]; + } + Store[opt.file] = store; store.put = function(file, data, cb){ var random = Math.random().toString(36).slice(-3); diff --git a/lib/rindexed.js b/lib/rindexed.js index fcccd9a1..281120ba 100644 --- a/lib/rindexed.js +++ b/lib/rindexed.js @@ -16,7 +16,10 @@ }}catch(e){} var store = function Store(){}; - if(Store[opt.file]){ return Store[opt.file] } + if(Store[opt.file]){ + console.log("Warning: reusing same IndexedDB store and options as 1st."); + return Store[opt.file]; + } Store[opt.file] = store; store.start = function(){ diff --git a/lib/rs3.js b/lib/rs3.js index 3c6c1630..5b56c2e9 100644 --- a/lib/rs3.js +++ b/lib/rs3.js @@ -41,8 +41,14 @@ function Store(opt){ opt.file = String(opt.file || 'radata'); var opts = opt.s3, s3 = opts.s3; var c = {p: {}, g: {}, l: {}}; - + var store = function Store(){}; + if(Store[opt.file]){ + console.log("Warning: reusing same S3 store and options as 1st."); + return Store[opt.file]; + } + Store[opt.file] = store; + store.put = function(file, data, cb){ var params = {Bucket: opts.bucket, Key: file, Body: data}; //console.log("RS3 PUT ---->", (data||"").slice(0,20)); diff --git a/package.json b/package.json index 3f3b34e5..47487569 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gun", - "version": "0.2019.423", + "version": "0.2019.425", "description": "A realtime, decentralized, offline-first, graph data synchronization engine.", "main": "index.js", "browser": "gun.js",