plasmidhq / plasmid

A browser database with optional multi-device syncronization
http://plasmid.readthedocs.org/en/latest/
30 stars 1 forks source link

Should act more IndexedDB with keys #7

Closed ironfroggy closed 11 years ago

ironfroggy commented 11 years ago

Plasmid at first was more of a key->value idea but IndexedDB is more ((key) value) where the key is just one part of the value itself.

put(key, value) will become put(object) and stores will define a keyPath can add a KeyValue store type to re-implement basic key-value semantics on top of this, later.

ironfroggy commented 11 years ago

If this is done, it should be optional maybe?

LocalStore becomes LocalIDBStore as an abstraction simply on the raw backing. It, therefore, should include a keypath and put/add should act more like the native things they wrap.

Add KeyStore on top of this, the same way SyncStore is. But, what if we need multiple behaviors added?

If this ticket is done, then other behaviors need to be expressed as extensions that, for a given store, can add or override the methods and behavior.

ironfroggy commented 11 years ago

Two competing models here: key/value and document store.

IDB is a document store, but our sync model works better with key/value, I thought. I might be wrong. As long as we always have a key, it shouldn't matter...

Key/value store: get(key) put(key, value) add(key, value) remove(key) but, what about meta...?

Document is easier. get(key) put(doc) add(doc) remove(key) and meta gets attached inside the document object, under some prefixed field.

Maybe per-item meta was a bad idea?