0.0.5 • Published 1 year ago
svelte-hub v0.0.5
svelte-couchdb-hub
This component will create a couchdb hub that syncs and collects one to many different databases into one local repository, nodes
.
Page load scenarios:
- check if localstorage? -> unless default couchdb load nodes
- has default couchdb in nodes?
Checks:
- isLocalStorageAvailable
- isHostCouchDB
- isLocalHostCouchDB
- hasNodesDefaultHost
- hasHostPublic
- isUserAdmin
How to sync documents
Documents have @room property Rooms have host and _sync property $: nodesid.@sync -> update documents
Document loads
- Either they are preloaded
- or they have children, if no @url use parents
- else use @url
{
_id:uuid,
_rev:revid,
@room: theRoom,
children:[
{id:uuid},
{id:uuid, url:someURLinclRoom}
]
}
Should new hosts/rooms be created?
generic loadDoc(id) which first checks if do is in nodes, otherwise loads, checks children, then loads these too, with depth awareness.
Document local properties
- @room
- @depth
- $depth is session user overriden property!
you have panel-wide props (e.g. depth) or document wide. How about session?
couchDB always has index.html at couchdb.com/public/index.html and also a default root document, defaultRoot.
Note: couch_set_default_database(database)
flowchart TD
A[Page load]-->B{host \ncouchDB?}
B-->|yes| C{Check if \n public db}
B-->|no|E{Check localhost}
A-->E
C-->|no| D[something]
C-->|yes| G{Check if\nid in url}
E-->|yes| C
E-->|no| D
G-->|yes| H[load id]
F[login]