mirror of
https://github.com/amark/gun.git
synced 2025-06-03 20:56:43 +00:00
same process instances should share RAD plugins for same file options to prevent corruption
This commit is contained in:
parent
782f66cd49
commit
ecffdce786
@ -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);
|
||||
|
@ -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(){
|
||||
|
@ -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));
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user