Proposed Server API
Proposed Server API
Data Model
API (objId below refers to (table, key)):
- get(objId) -> (val, version) | error
- put(objId, val, version, [[ idxname, key ] ... ]) -> version | error
- version either specifies the previous version read, to ensure update consistency, or INF to force
- [ idxname, key ] pairs specify indexes to insert into in the associated table with associated keys
- delete(objId, version) -> version | error
- Remove the object, but only if version matches the current instance or is INF
- lookup(tblpath, idxname, min, max) -> (val, version, primary_key?)
- What types for indexes (i.e. are min & max one of string, int, float)?
Note that using versions we can create higher-level synchronization primitives, but do we want cmpxchg or something similar for performance reasons?
Do we want reads/writes to be full-update only? What about appending writes or writes to subranges?
What do we want keys to be?
- Fixed n-bit length, set by system?
- hash(crud), user-defined?
- Variable-length blobs (generalization of above)?
Indexing
API (objId below refers to (table, key)):
- createIndex(table, idxname)
- destroyIndex(table, idxname)
- addIndexEntry(objId, idxname)
- delIndexEntry(objId, idxname)
- findEntries(table, idxname, min, max)
We probably want multiple flavours of indexes (hash tables, trees, etc).
- Hash tables often add a performance advantage at cost of range queries (http://www.sanger.ac.uk/Users/lh3/udb.shtml).
- Is there a reasonable compromise?