notes and API docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-01 11:12:13 +03:00
parent 55e8daa4ce
commit 6a0dc89c45
2 changed files with 56 additions and 0 deletions

View File

@ -54,6 +54,53 @@ function(name, get, update, ...args){
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Store... // Store...
//
// API levels:
// Level 1 -- implementation API
// This level is the base API, this is used by all other Levels.
// This is the only level that needs to be fully overloaded by store
// implementations (no super calls necessary).
// The base methods that need to be overloaded for the store to work:
// .__paths__()
// -> <keys>
// .__exists__(path, ..)
// -> <path>
// -> false
// .__get__(path, ..)
// -> <data>
// Optional for r/w stores:
// .__update__(path, ..)
// .__delete__(path, ..)
// Level 2 -- feature API
// This can use Level 1 and Level 2 internally.
// When overloading it is needed to to call the super method to
// retain base functionality.
// All overloading here is optional.
// .paths()
// -> <path-list>
// .names()
// -> <name-index>
// .exists(<path>)
// -> <real-path>
// -> false
// .get(<path>)
// -> <data>
// -> undefined
// .metadata(<path>[, <data>])
// -> <store> -- on write
// -> <data>
// -> undefined
// .update(<path>, <data>)
// -> <store>
// .delete(<path>)
// -> <store>
// .load(..)
// -> <store>
// .json(..)
// -> <json>
// Level 3
// ...
//
// //
// To create a store adapter: // To create a store adapter:
// - inherit from BaseStore // - inherit from BaseStore

View File

@ -1,6 +1,9 @@
/********************************************************************** /**********************************************************************
* *
* *
* XXX might be a good idea to make some methods that only access the
* index sync -- this will make the store unusable while indexing
* though...
* XXX ASAP prevent paths from using reserved chars like: ":", "#", ... * XXX ASAP prevent paths from using reserved chars like: ":", "#", ...
* XXX FEATURE list macro paging... * XXX FEATURE list macro paging...
* ...should this be macro level or handled in .each() * ...should this be macro level or handled in .each()
@ -34,6 +37,12 @@
* /some/path/!action * /some/path/!action
* ..."!" is removed before the <store>.__<name>__(..) calls... * ..."!" is removed before the <store>.__<name>__(..) calls...
* XXX ENERGETIC revise naming... * XXX ENERGETIC revise naming...
* XXX OPTIMIZE might be a good idea to move stuff down the stack to Store:
* .each() -> .store.each(<path>)
* ...this will enable ups to optimize page loading on a store
* level...
* ...another approach would be to make .get(..) accept a list of
* paths and return an iterator...
* XXX OPTIMIZE page search: make things invariant via .names * XXX OPTIMIZE page search: make things invariant via .names
* - if a page is in a system path and there are no alternatives * - if a page is in a system path and there are no alternatives
* just return it and do not search. * just return it and do not search.