[−][src]Trait krill::commons::eventsourcing::KeyStore
Generic KeyStore for AggregateManager
Associated Types
type Key: From<CommandKey> + From<&'static CommandKey> + TryInto<CommandKey>
Required methods
fn get_version(&self) -> Result<KeyStoreVersion, KeyStoreError>
fn set_version(&self, version: &KeyStoreVersion) -> Result<(), KeyStoreError>
fn key_for_info() -> Self::Key
fn key_for_snapshot() -> Self::Key
fn key_for_event(version: u64) -> Self::Key
fn key_for_command<S: WithStorableDetails>(
command: &StoredCommand<S>
) -> CommandKey
command: &StoredCommand<S>
) -> CommandKey
fn keys(&self, id: &Handle, matching: &str) -> Vec<Self::Key>
Returns all keys for a Handle in the store, matching a &str
fn keys_ascending(&self, id: &Handle, matching: &str) -> Vec<Self::Key>
Returns all keys for a Handle in the store, matching a &str, sorted ascending
fn command_keys_ascending(
&self,
id: &Handle,
crit: &CommandHistoryCriteria
) -> Vec<CommandKey>
&self,
id: &Handle,
crit: &CommandHistoryCriteria
) -> Vec<CommandKey>
fn has_key(&self, id: &Handle, key: &Self::Key) -> bool
Returns whether a key already exists.
fn has_aggregate(&self, id: &Handle) -> bool
fn aggregates(&self) -> Vec<Handle>
fn store<V: Any + Serialize>(
&self,
id: &Handle,
key: &Self::Key,
value: &V
) -> Result<(), KeyStoreError>
&self,
id: &Handle,
key: &Self::Key,
value: &V
) -> Result<(), KeyStoreError>
Write or overwrite the value for an existing. Must not throw an error if the key already exists.
fn get<V: Any + Storable>(
&self,
id: &Handle,
key: &Self::Key
) -> Result<Option<V>, KeyStoreError>
&self,
id: &Handle,
key: &Self::Key
) -> Result<Option<V>, KeyStoreError>
Get the value for this key, if any exists.
fn drop(&self, id: &Handle, key: &Self::Key) -> Result<(), KeyStoreError>
Drop the value for this key
fn get_event<V: Event>(
&self,
id: &Handle,
version: u64
) -> Result<Option<V>, KeyStoreError>
&self,
id: &Handle,
version: u64
) -> Result<Option<V>, KeyStoreError>
Get the value for this key, if any exists.
fn store_event<V: Event>(&self, event: &V) -> Result<(), KeyStoreError>
MUST check if the event already exists and return an error if it does.
fn store_command<S: WithStorableDetails>(
&self,
command: StoredCommand<S>
) -> Result<(), KeyStoreError>
&self,
command: StoredCommand<S>
) -> Result<(), KeyStoreError>
fn get_aggregate<V: Aggregate>(
&self,
id: &Handle
) -> Result<Option<V>, KeyStoreError>
&self,
id: &Handle
) -> Result<Option<V>, KeyStoreError>
Get the latest aggregate
fn store_snapshot<V: Aggregate>(
&self,
id: &Handle,
aggregate: &V
) -> Result<(), KeyStoreError>
&self,
id: &Handle,
aggregate: &V
) -> Result<(), KeyStoreError>
Saves the latest snapshot - overwrites any previous snapshot.
Provided methods
fn get_info(&self, id: &Handle) -> Result<StoredValueInfo, KeyStoreError>
fn save_info(
&self,
id: &Handle,
info: &StoredValueInfo
) -> Result<(), KeyStoreError>
&self,
id: &Handle,
info: &StoredValueInfo
) -> Result<(), KeyStoreError>
fn command_history<A: Aggregate>(
&self,
id: &Handle,
crit: CommandHistoryCriteria
) -> Result<CommandHistory, KeyStoreError>
&self,
id: &Handle,
crit: CommandHistoryCriteria
) -> Result<CommandHistory, KeyStoreError>
Find all commands that fit the criteria and return history
Implementors
impl KeyStore for DiskKeyStore
[src]
type Key = PathBuf
fn get_version(&self) -> Result<KeyStoreVersion, KeyStoreError>
[src]
fn set_version(&self, version: &KeyStoreVersion) -> Result<(), KeyStoreError>
[src]
fn key_for_info() -> Self::Key
[src]
fn key_for_snapshot() -> Self::Key
[src]
fn key_for_event(version: u64) -> Self::Key
[src]
fn key_for_command<S: WithStorableDetails>(
command: &StoredCommand<S>
) -> CommandKey
[src]
command: &StoredCommand<S>
) -> CommandKey
fn keys(&self, id: &Handle, matching: &str) -> Vec<Self::Key>
[src]
fn keys_ascending(&self, id: &Handle, matching: &str) -> Vec<Self::Key>
[src]
fn command_keys_ascending(
&self,
id: &Handle,
crit: &CommandHistoryCriteria
) -> Vec<CommandKey>
[src]
&self,
id: &Handle,
crit: &CommandHistoryCriteria
) -> Vec<CommandKey>
fn has_key(&self, id: &Handle, key: &Self::Key) -> bool
[src]
fn has_aggregate(&self, id: &Handle) -> bool
[src]
fn aggregates(&self) -> Vec<Handle>
[src]
fn store<V: Any + Serialize>(
&self,
id: &Handle,
key: &Self::Key,
value: &V
) -> Result<(), KeyStoreError>
[src]
&self,
id: &Handle,
key: &Self::Key,
value: &V
) -> Result<(), KeyStoreError>
fn get<V: Any + Storable>(
&self,
id: &Handle,
key: &Self::Key
) -> Result<Option<V>, KeyStoreError>
[src]
&self,
id: &Handle,
key: &Self::Key
) -> Result<Option<V>, KeyStoreError>
fn drop(&self, id: &Handle, key: &Self::Key) -> Result<(), KeyStoreError>
[src]
fn get_event<V: Event>(
&self,
id: &Handle,
version: u64
) -> Result<Option<V>, KeyStoreError>
[src]
&self,
id: &Handle,
version: u64
) -> Result<Option<V>, KeyStoreError>
Get the value for this key, if any exists.
fn store_event<V: Event>(&self, event: &V) -> Result<(), KeyStoreError>
[src]
fn store_command<S: WithStorableDetails>(
&self,
command: StoredCommand<S>
) -> Result<(), KeyStoreError>
[src]
&self,
command: StoredCommand<S>
) -> Result<(), KeyStoreError>
fn get_aggregate<V: Aggregate>(
&self,
id: &Handle
) -> Result<Option<V>, KeyStoreError>
[src]
&self,
id: &Handle
) -> Result<Option<V>, KeyStoreError>
fn store_snapshot<V: Aggregate>(
&self,
id: &Handle,
aggregate: &V
) -> Result<(), KeyStoreError>
[src]
&self,
id: &Handle,
aggregate: &V
) -> Result<(), KeyStoreError>