zordfsdb #2
🏷 myapp
🏷 idea
Created: 2024-08-12
Copyright: CC-BY-SA 4.0
Language: en
I wrote about my new file system based datebase earlier:
zordfsdb
Update
I decided to split commands into two layers: value and object. For value layer there are already implemented commands what operates directly on value by given path. And for object layer I added two more commands what operates directly on node:
- GetNode (created earlier) - get node - it's not important the type. It can be list, object or single key/value object.
- CreateNode - create directory in given path. Will it be object or list - it depends on future actions.
- AddObject - create abcex indexed directory as object. Later you can add key/values
And there other commands what suits for all or are for special case (already created earlier):
- Init - get db object
- Keys - get list of object keys or list index
- Del - remove key/value, list, object etc.
Object creation flow
For example I need structure:
/obj1
|
+ key1 -- counter that increase
+ key2 -- date now
+ key3 -- special value
Your actions should be:
- db = Init("/")
- db.CreateNode("obj1")
- db.Inc("obj1.key1")
- db.Now("obj1.key2")
- db.Save("obj1.key3", "special value")
List creation flow
There is now structure validators or pattern (maybe for future), so everything should be under developer control.
For example I need structure:
/list1
|
+ 0
| |
| + key1 -- special value
| + key2 -- special value 2
+ 1
|
+ key1 -- special value
+ key2 -- special value 2
Your actions should be:
- db = Init("/")
- db.CreateNode("list1")
- id1 = db.AddObject("list1") <-- first id will be '0'
- db.Save("list1.0.key1", "special value")
- db.Save("list1.0.key2", "special value 2")
- id2 = db.AddObject("list1") <-- second id will be '1'
- db.Save("list1.1.key1", "special value")
- db.Save("list1.1.key2", "special value 2")
Future plans
For now I have everything what I needed but... If I will have time, it would be nice to have:
- list object validator or pattern with default values
- blob or file as value. Maybe it should be with special folder on root (__a) and key file should be link
zordfsdb repository
🌿 dev
🏠 home
Page counter: c