-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Holster currently provides a simple API by calling for example, const holster = Holster() in either Node or the browser.
This provides access to holster.get() and holster.put() methods, as well as holster.wire which provides access to another set of get() and put() methods, which are complimentary to the Holster API and use the wire specification directly. See the examples folder for how they can be used to achieve similar outcomes.
The Holster API itself uses the wire API, but it's aim is to get only strings as keys and put a limited set of data types. These are the same as GunDB, ie 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 already 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.
- Options aren't passed in to Holster yet
- Storage is only on Node, add to browsers
Some of the above TODO's are easy while others require more thought. I would like to add indexedDB next so that the browser version is the same as the Node version. I'm not sure about localStorage as an option as it's so limited, but will at least make it possible to switch storage adapters.
After that I really want to get something like SEA working, as it's a requirement to use Holster in a real web application. I'm hoping indexedDB and SEA can both be incorporated from the existing GunDB code. After that who knows maybe DAM will be possible too.