Skip to content
Malcolm Blaney edited this page May 24, 2025 · 20 revisions

Introduction

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 can write data to "public space", which should only be used for testing or private applications, since it's available to all clients. It can also write data to "user space" using the User API, which will store data under user accounts and sign and verify all updates.

The User API relies heavily on the SEA API (Security, Encryption and Authorization), which is also very useful in other applications using Holster, so those functions are made available via holster.SEA so you don't need to include it yourself.

Holster 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. There are also examples of how to use the User and SEA API's.

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.

TODO

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).

Next steps

  • Lex is 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.
  • Start writing applications that user Holster!

Clone this wiki locally