mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-19 09:31:39 +00:00
book-keeping + revision of indexing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
11f801dddd
commit
19a521121e
@ -406,10 +406,10 @@ module.BaseStore = {
|
|||||||
&& path.startsWith(this.__cache_path__)){
|
&& path.startsWith(this.__cache_path__)){
|
||||||
return data }
|
return data }
|
||||||
//*/
|
//*/
|
||||||
var {tags, paths} = await data
|
|
||||||
// remove obsolete tags...
|
// remove obsolete tags...
|
||||||
this.__tags.options.remove.call(this, data, name, path)
|
data = await this.__tags.options.remove.call(this, data, name, path)
|
||||||
// add...
|
// add...
|
||||||
|
var {tags, paths} = data
|
||||||
paths[path] = new Set(update.tags)
|
paths[path] = new Set(update.tags)
|
||||||
for(var tag of update.tags ?? []){
|
for(var tag of update.tags ?? []){
|
||||||
;(tags[tag] =
|
;(tags[tag] =
|
||||||
@ -572,6 +572,8 @@ module.BaseStore = {
|
|||||||
|
|
||||||
|
|
||||||
// XXX EXPERIMENTAL...
|
// XXX EXPERIMENTAL...
|
||||||
|
// This keeps the changes between saves...
|
||||||
|
//
|
||||||
// XXX see issues with indexedDB...
|
// XXX see issues with indexedDB...
|
||||||
// XXX not sure if we need this...
|
// XXX not sure if we need this...
|
||||||
// XXX need a persistent fast store of changes...
|
// XXX need a persistent fast store of changes...
|
||||||
@ -603,13 +605,6 @@ module.BaseStore = {
|
|||||||
data.then(_get)
|
data.then(_get)
|
||||||
: _get(data) },
|
: _get(data) },
|
||||||
|
|
||||||
// XXX do we need this???
|
|
||||||
'journal-clear': function(data, name){
|
|
||||||
this.__journal('clear')
|
|
||||||
this.__journal_db
|
|
||||||
&& this.__journal_db.clear()
|
|
||||||
return data },
|
|
||||||
|
|
||||||
// XXX these need to be persistent...
|
// XXX these need to be persistent...
|
||||||
update: async function(data, name, path, update){
|
update: async function(data, name, path, update){
|
||||||
var date = this.__journal_db ?
|
var date = this.__journal_db ?
|
||||||
@ -628,24 +623,19 @@ module.BaseStore = {
|
|||||||
data.push([Date.now(), 'remove', path])
|
data.push([Date.now(), 'remove', path])
|
||||||
return data },
|
return data },
|
||||||
|
|
||||||
// XXX clear the .__journal_db...
|
|
||||||
save: async function(data, name){
|
save: async function(data, name){
|
||||||
data = await data
|
this.__journal_db
|
||||||
data.push([Date.now(), 'save'])
|
&& this.__journal_db.clear()
|
||||||
if(this.__cache_path__){
|
return [] },
|
||||||
var path = this.__cache_path__ +'/'+ name+'_index'
|
// XXX if .__journal_db is not empty then need to apply it to the index???
|
||||||
this.update(path, {index: data}) }
|
|
||||||
return data},
|
|
||||||
// XXX populate the .__journal_db???
|
|
||||||
load: async function(data, name){
|
load: async function(data, name){
|
||||||
// load...
|
// XXX
|
||||||
if(this.__cache_path__){
|
|
||||||
var path = this.__cache_path__ +'/'+ name+'_index'
|
|
||||||
data = (await this.get(path) ?? {}).index ?? [] }
|
|
||||||
return data },
|
return data },
|
||||||
|
|
||||||
reset: function(data, name){
|
reset: function(data, name){
|
||||||
this.__cache_path__
|
this.__journal_db
|
||||||
&& this.delete(this.__cache_path__ +'/'+ name+'_index') }, }),
|
&& this.__journal_db.clear()
|
||||||
|
return [] }, }),
|
||||||
journal: function(){
|
journal: function(){
|
||||||
return this.__journal('__call__', ...arguments)},
|
return this.__journal('__call__', ...arguments)},
|
||||||
//*/
|
//*/
|
||||||
|
|||||||
17
pwiki2.js
17
pwiki2.js
@ -26,6 +26,8 @@
|
|||||||
* - server / replication target
|
* - server / replication target
|
||||||
* - management
|
* - management
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
* XXX things that will help:
|
* XXX things that will help:
|
||||||
* - async render (infinite scroll + search + large pages)
|
* - async render (infinite scroll + search + large pages)
|
||||||
* unresolved -> dom placeholder
|
* unresolved -> dom placeholder
|
||||||
@ -34,8 +36,14 @@
|
|||||||
* -
|
* -
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* XXX ASAP: do/test IndexedDB journal "live" store...
|
* XXX index: need to disable index persistence on memory stores...
|
||||||
* XXX BUG: <store>.tags.tags seems to be broken -- no paths in sets...
|
* XXX index: would be nice to somehow persistently auto-generate index id's...
|
||||||
|
* ...maybe: "<prefix>:<path>" or something similar...
|
||||||
|
* ...would be nice to have store ids...
|
||||||
|
* XXX <store>.journal: needed to break the update recursion -- i.e. decouple
|
||||||
|
* index .update(..) handlers from stored page updates by first
|
||||||
|
* updating the journal and on a timer updating the .cache/<index> page...
|
||||||
|
* XXX do/test IndexedDB journal "live" store...
|
||||||
* XXX BUG: indexedDB: .deleteDatabase(..) does not actually delete the
|
* XXX BUG: indexedDB: .deleteDatabase(..) does not actually delete the
|
||||||
* database from the list until reload.
|
* database from the list until reload.
|
||||||
* this breaks trying to open a database with the same name again...
|
* this breaks trying to open a database with the same name again...
|
||||||
@ -387,11 +395,14 @@
|
|||||||
* Architecture:
|
* Architecture:
|
||||||
*
|
*
|
||||||
* store <-> index
|
* store <-> index
|
||||||
* ^
|
* ^ ^
|
||||||
|
* | |
|
||||||
|
* +---------+
|
||||||
* |
|
* |
|
||||||
* page <--> renderer
|
* page <--> renderer
|
||||||
* ^
|
* ^
|
||||||
* |
|
* |
|
||||||
|
* |
|
||||||
* client
|
* client
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user