- From: James Halliday <substack@gmail.com>
- Date: Thu, 17 Apr 2014 17:56:26 -0700
- To: public-webapps@w3.org
Things I think are important: * asynchronous get/put * iterators on sorted keys (so we can implement efficient indexes and nice streaming abstractions) * batch put/del - not sure if it already has this, but these are super necessary for implementing custom indexing schemes * binary keys - combined with sorted key iterators, with binary keys you can do some really interesting things in userspace with sorting like typewise: https://www.npmjs.org/package/typewise * binary values - store bulk data without the overhead of string conversion * mutation observers - a simple event-based API that emits objects with { type: 'put|del|batch', key: '...', value: '...' } would do fine here, like leveldb. This might be a good place for modules to provide hooks for indexing similar to `ev.preventDefault()` for dom elements. After preventing the default mutation, the indexing modules could do batch put/del into the database on their own and then have another function to indicate back to the caller that triggered the mutation in the first place that the operation failed or succeeded. Here is a related module to look at for API inspiration: https://github.com/dominictarr/level-hooks Things I don't particularly care about: * promises * batched gets * existence checks * transactions - these seem like complications These things should NOT be implemented: * full text search - This is a very specific kind of index. Just give us the primitives to implement general-purpose indexes instead. * IDBKeyRange boolean operators - give userspace enough primitives to implement indexing ourselves instead of baking in a DSL A good starting point as Raynos has already mentioned is the leveldown api, which has proved sufficient to sustain a huge ecosystem of packages that implement features of traditional databases in a highly modular way: https://github.com/rvagg/node-leveldown
Received on Friday, 18 April 2014 06:43:52 UTC