testing store interoperability (bugfixing) + notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-08-26 18:16:07 +03:00
parent fb82119d8c
commit eec1e725d3
7 changed files with 35 additions and 9 deletions

View File

@ -25,18 +25,27 @@ var pouchdbstore = require('./pwiki/store/pouchdb')
//---------------------------------------------------------------------
var store =
module.store =
{ __proto__: basestore.BaseStore }
.nest({ __proto__: basestore.MetaStore })
module.store = {
// XXX base localstorage...
__proto__: localstoragestore.localStorageStore,
__prefix__: '--pwiki-root:',
data: localStorage,
/*/
__proto__: basestore.MetaStore,
//*/
next: { __proto__: basestore.BaseStore },
}
module.setup =
Promise.all([
// static stores...
//
store.update('Settings',
Object.create(basestore.BaseStore).load(page.Settings)),
//store.next.update('System',
store.update('System',
Object.create(basestore.BaseStore).load(page.System)),
store.update('Settings',
Object.create(basestore.BaseStore).load(page.Settings)),
store.update('Test',
Object.create(basestore.BaseStore).load(page.Test)),

View File

@ -1643,6 +1643,10 @@ module.System = {
<hr>
<pre wikiwords="no"><quote filter="quote-tags" src=".."/></pre> ` },
// XXX need to also be able to list things about each store...
stores: function(){
return Object.keys(this.store.substores ?? {}) },
// page parts...
//
'line-separator': { text: '<br>' },
@ -1651,6 +1655,7 @@ module.System = {
// base system pages...
//
// NOTE: these are last resort pages, preferably overloaded in /Templates.
//
RecursionError: {
text: 'RECURSION ERROR: @quote(../path)' },
NotFoundError: {

View File

@ -503,7 +503,7 @@ module.BaseStore = {
JSON.stringify(res, options.replacer, options.space)
: res },
// XXX NEXT EXPERIMENTAL...
/*/ XXX NEXT EXPERIMENTAL...
nest: function(base){
return {
__proto__: base
@ -511,6 +511,7 @@ module.BaseStore = {
next: this,
data: {}
} },
//*/
}

View File

@ -520,7 +520,8 @@ module.backup = {
// XXX add monitor API + cache + live mode (auto on when lock detected)...
var FileStoreRO =
module.FileStoreRO = {
__proto__: base.BaseStore,
//__proto__: base.BaseStore,
__proto__: base.MetaStore,
// XXX
__path__: 'data/fs',

View File

@ -20,7 +20,8 @@ var base = require('./base')
// XXX EXPERIMENTAL, needs testing in browser...
var localStorageStore =
module.localStorageStore = {
__proto__: base.BaseStore,
//__proto__: base.BaseStore,
__proto__: base.MetaStore,
__prefix__: '--pwiki:',
// XXX add caching of unserialized data???

View File

@ -20,7 +20,8 @@ var PouchDB = require('pouchdb')
var PouchDBStore =
module.PouchDBStore = {
__proto__: base.BaseStore,
//__proto__: base.BaseStore,
__proto__: base.MetaStore,
// XXX should this be __path__???
// ...this sets the path where the store is created...

View File

@ -1,6 +1,14 @@
/**********************************************************************
*
*
* XXX BUG: for some reason pwiki.get('/TestPage').raw does nothing when
* the root store is not BaseStore...
* ...seems to be a problem explicitly with /TestPage, could this
* be a name clash with /Test???
* XXX BUG service pages (*Error) now print "[ native code ]" instead of
* the path and replacing @quote(..) with @source(..) breaks things...
* ...this seems to happen only if the root store is not
* MetaStore/BaseStore...
* XXX page search: make things invariant via .names
* - if a page is in a system path and there are no alternatives
* just return it and do not search.