pub struct StreamVersioning<T>{ /* private fields */ }Expand description
Stream versioning manager
Implementations§
Source§impl<T> StreamVersioning<T>
impl<T> StreamVersioning<T>
Sourcepub fn new(config: VersioningConfig) -> Self
pub fn new(config: VersioningConfig) -> Self
Create a new stream versioning manager
Sourcepub async fn create_version(
&self,
events: Vec<T>,
description: &str,
) -> Result<VersionId, StreamError>
pub async fn create_version( &self, events: Vec<T>, description: &str, ) -> Result<VersionId, StreamError>
Create a new version with events
Sourcepub async fn add_events(&self, events: Vec<T>) -> Result<usize, StreamError>
pub async fn add_events(&self, events: Vec<T>) -> Result<usize, StreamError>
Add events to current version
Sourcepub async fn time_travel_query(
&self,
query: TimeTravelQuery,
) -> Result<Vec<VersionedEvent<T>>, StreamError>
pub async fn time_travel_query( &self, query: TimeTravelQuery, ) -> Result<Vec<VersionedEvent<T>>, StreamError>
Execute a time-travel query
Sourcepub async fn get_at_version(
&self,
version_id: VersionId,
) -> Result<Vec<VersionedEvent<T>>, StreamError>
pub async fn get_at_version( &self, version_id: VersionId, ) -> Result<Vec<VersionedEvent<T>>, StreamError>
Get events at a specific version
Sourcepub async fn get_at_timestamp(
&self,
timestamp: SystemTime,
) -> Result<Vec<VersionedEvent<T>>, StreamError>
pub async fn get_at_timestamp( &self, timestamp: SystemTime, ) -> Result<Vec<VersionedEvent<T>>, StreamError>
Get events at a specific timestamp
Sourcepub async fn create_snapshot(&self, name: &str) -> Result<String, StreamError>
pub async fn create_snapshot(&self, name: &str) -> Result<String, StreamError>
Create a snapshot
Sourcepub async fn restore_snapshot(
&self,
snapshot_id: &str,
) -> Result<VersionId, StreamError>
pub async fn restore_snapshot( &self, snapshot_id: &str, ) -> Result<VersionId, StreamError>
Restore from snapshot
Sourcepub async fn create_branch(
&self,
name: &str,
description: &str,
) -> Result<BranchId, StreamError>
pub async fn create_branch( &self, name: &str, description: &str, ) -> Result<BranchId, StreamError>
Create a new branch
Sourcepub async fn switch_branch(&self, branch_id: &str) -> Result<(), StreamError>
pub async fn switch_branch(&self, branch_id: &str) -> Result<(), StreamError>
Switch to a different branch
Sourcepub async fn merge_branch(
&self,
source_branch_id: &str,
) -> Result<VersionId, StreamError>
pub async fn merge_branch( &self, source_branch_id: &str, ) -> Result<VersionId, StreamError>
Merge a branch into the current branch
Sourcepub async fn diff(
&self,
from_version: VersionId,
to_version: VersionId,
) -> Result<VersionDiff<T>, StreamError>
pub async fn diff( &self, from_version: VersionId, to_version: VersionId, ) -> Result<VersionDiff<T>, StreamError>
Get diff between two versions
Sourcepub async fn generate_changeset(
&self,
from_version: VersionId,
to_version: VersionId,
) -> Result<Changeset<T>, StreamError>
pub async fn generate_changeset( &self, from_version: VersionId, to_version: VersionId, ) -> Result<Changeset<T>, StreamError>
Generate changeset between versions
Sourcepub async fn get_version_history(&self) -> Vec<VersionMetadata>
pub async fn get_version_history(&self) -> Vec<VersionMetadata>
Get version history
Sourcepub async fn get_branches(&self) -> Vec<Branch>
pub async fn get_branches(&self) -> Vec<Branch>
Get all branches
Sourcepub async fn current_version(&self) -> VersionId
pub async fn current_version(&self) -> VersionId
Get current version
Sourcepub async fn current_branch(&self) -> BranchId
pub async fn current_branch(&self) -> BranchId
Get current branch
Sourcepub async fn get_stats(&self) -> VersioningStats
pub async fn get_stats(&self) -> VersioningStats
Get statistics
Sourcepub async fn tag_version(
&self,
version_id: VersionId,
key: &str,
value: &str,
) -> Result<(), StreamError>
pub async fn tag_version( &self, version_id: VersionId, key: &str, value: &str, ) -> Result<(), StreamError>
Tag a version
Sourcepub async fn find_by_tag(&self, key: &str, value: &str) -> Vec<VersionId> ⓘ
pub async fn find_by_tag(&self, key: &str, value: &str) -> Vec<VersionId> ⓘ
Find versions by tag
Sourcepub async fn delete_branch(&self, branch_id: &str) -> Result<(), StreamError>
pub async fn delete_branch(&self, branch_id: &str) -> Result<(), StreamError>
Delete a branch
Sourcepub async fn compact(&self) -> Result<usize, StreamError>
pub async fn compact(&self) -> Result<usize, StreamError>
Compact old versions
Auto Trait Implementations§
impl<T> Freeze for StreamVersioning<T>
impl<T> !RefUnwindSafe for StreamVersioning<T>
impl<T> Send for StreamVersioning<T>
impl<T> Sync for StreamVersioning<T>
impl<T> Unpin for StreamVersioning<T>
impl<T> UnsafeUnpin for StreamVersioning<T>
impl<T> !UnwindSafe for StreamVersioning<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.