Better namespacing multidatabase
parent
ece8dd7f60
commit
1d9c13640d
|
|
@ -1283,8 +1283,7 @@
|
||||||
{
|
{
|
||||||
this.databases.push(arguments[i]);
|
this.databases.push(arguments[i]);
|
||||||
}
|
}
|
||||||
this.deltas = new Deltas(this.primary());
|
this.deltas = new Deltas(this.cache());
|
||||||
this.cachedb = new NamespacedDatabase("cache", new Local()),
|
|
||||||
this.scheduleSync();
|
this.scheduleSync();
|
||||||
this.syncCacheWithPrimary();
|
this.syncCacheWithPrimary();
|
||||||
}
|
}
|
||||||
|
|
@ -1310,7 +1309,9 @@
|
||||||
|
|
||||||
cache()
|
cache()
|
||||||
{
|
{
|
||||||
return this.cachedb;
|
if (this.databases.length > 1)
|
||||||
|
return this.databases[1];
|
||||||
|
return this.primary();
|
||||||
}
|
}
|
||||||
|
|
||||||
primary()
|
primary()
|
||||||
|
|
@ -1320,7 +1321,7 @@
|
||||||
|
|
||||||
replicas()
|
replicas()
|
||||||
{
|
{
|
||||||
return [this.cache()].concat(this.databases.slice(1));
|
return this.databases.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleSync()
|
scheduleSync()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue