-
Notifications
You must be signed in to change notification settings - Fork 3
Architecture :: Data Stores
The approach taken to maintaining the state of the entity database is one of unenforced consistency. Relationships between entities exist (a device belongs to a user), but they may not be always valid. For example, removing a user does not cause the removal of its associated devices (as part of the same operation). Eventually, a maintenance process should run and clean up orphan entries.
This is done primarily to keep the original request relatively simple (a single entry from a single table/database is removed or marked as deleted). As a nice side effect, this approach keeps child entries around for a while after the parent is discarded; a malicious or accidental deletion will not cause data loss right away.
The core
submodule defines a set of entities used for managing the data exchange. The server
submodule also defines its own set of entities, used for dealing with users, devices, backups and scheduling. Since the
server
is the actual, runnable service, it includes one or more core
endpoints and is therefore responsible for
handling the core
persistence as well (deciding which backends are to be used, how they are initialized, etc).
Various data stores are used throughout the codebase for keeping track of entities such as nodes, users and devices. They do not depend on any storage implementation or database; the expectation is that a storage backend of the required type will be provided on initialization.
-
EventLogBackend
- receives a stream of events and updates its state; state updates can be streamed to subscribers -
KeyValueBackend
- data is stored with its associated key and can be retrieved back with that key -
StreamingBackend
- same asKeyValueBackend
but for storing binary data that is streamed back to the caller; meant for storing crates as they are not expected to fit entirely in memory
-
in-memory
-all types
; data is stored in memory -
file / container-based
-StreamingBackend
; crates packed into files (containers) -
file / directory-based
-StreamingBackend
; crates stored as individual files in a directory -
Geode
-KeyValueBackend
; entity store based on Apache Geode -
Slick
-KeyValueBackend
; entity store based on Slick