Helma Logo
main list history

Version 1 by maks on 21. January 2008, 23:59

1===Proposal:===
2
3A new, alternative data store for use as Helma's "internal" DB.
4The aim is to make it production quality so it could be recommended for  production deployment as well as initial development work.
5
6===Implementation===
7* Seperate folder for each Prototype, each folder is named after prototype whose objects it stores
8* Each Prototype folder has 10 folders, named "0" to "9". A HopObject whose is stored in the folder that matches the last digit of its ID, eg. in folder "2" you would store object with id: 2, 12, 22,..., 1002, etc.
9* Each prototype has its own consecutive ID counter, stored in a file called counter is each prototypes DB sub folder
10* Prototypes that extend a Prototype have their own named folder inside the parent Prototypes folder eg. jsdb/User/AdminUser/
11* Each file labelled with id of the object JSON format for each file
12* use #Prototype(id) for properties that represent other HopObjects
13* Because all access goes through JSAdapter get method, first time a property that is a HopObject is accessed, the JSAdapter get method will "patch up" a reference to the correct Helma Object, loading it if necessary. Of course is should also be possible to specify an "aggressive" loading strategy where references are patched up at load time for some Prototypes.
14
15e.g.
16
17  helma-1.6.1/
18    /jsdb
19        /User
20            /counter
21                /1
22                  /1.json
23                /2
24                  /2.json
25        /List
26            /counter
27            /1.json
28            /2.json
29        /Item
30            /counter
31            /1.json
32            /2.json
33            /3.json
34        /Profile
35            /counter
36            /1.json
37    etc.
38
39/User/1.json :
40  {
41    name : "fred",
42    lists : [#List(1), #List(2)],
43    profile : #Profile(1)
44  }
45