-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Holster is a service that allows synchronising data between devices using either Node.js or the browser.
It provides access to an API which has functions to get() and put() data, and on() to listen for updates. It also provides access to a lower level holster.wire API, which allows access to the wire specification used by WebSockets to communicate. See the examples folder for a comparison of how they can be used.
The Holster API itself uses the wire API, but it aims to simplify requests by chaining keys and allows storing nested data. The allowed data types are the same as GunDB's: strings, numbers, objects, true, false and null. The graph data stored on disk consists of nodes referenced by id, which is what the wire API works with. This means the Holster API is responsible for resolving keys to their node ids, and creating ids for objects where they don't exist.
The wire API uses the store API, which is not exposed to the user. The store API also provides get() and put() methods which themselves call radisk(), the radix-on-disk function initially from Porting Gun. I mention these layers because one of the goals of Holster is to make it easy to follow the code. Each layer can be run on it's own and has it's own tests. If there's a problem at any layer a test should be added that shows it was fixed.
There are currently some TODO's in the code:
- The in-memory graph stores all puts, which means it will grow indefinitely over time.
- WebSockets repeat all data, so all clients receive and store all data, this probably needs some filtering.
- Need to pass more options in to Holster (WebSocket url, etc).
Now that indexedDB is working in the browser, Holster would be usable in a web application if Gun's SEA was available. I'm hoping it can be incorporated from the existing GunDB code.
Lex is also currently only supported with the get item format, {".": "item"} it would be great to have the rest available. After that who knows maybe DAM will be possible too.