Subaru.Store.Behaviour behaviour (subaru v0.1.0)
View SourceCommon contract for any Subaru key-value storage backend.
This behaviour comes from the vision.md design document and is
the foundation for plugging different datastores.
Summary
Callbacks
Persist all stored data to the given path.
Clear all data from the storage backend.
Dump all vertices and edges currently in the store.
Initialize the storage backend with the given options.
Returns a lazy enumerable of {key, value} tuples for all keys with the given prefix.
Restore data previously persisted via backup/1.
Executes the given function inside a read-only snapshot if the backend supports snapshots. Defaults to just running the function.
Stop the storage backend.
Types
Callbacks
Persist all stored data to the given path.
@callback clear(nodes :: [atom()]) :: :ok
Clear all data from the storage backend.
Dump all vertices and edges currently in the store.
Initialize the storage backend with the given options.
@callback iterate(prefix :: binary(), opts()) :: Enumerable.t()
Returns a lazy enumerable of {key, value} tuples for all keys with the given prefix.
Restore data previously persisted via backup/1.
Executes the given function inside a read-only snapshot if the backend supports snapshots. Defaults to just running the function.
@callback stop() :: :ok
Stop the storage backend.