Struct eventstore::prelude::Client
source[−]pub struct Client { /* private fields */ }
Expand description
Represents a client to a single node. Client
maintains a full duplex
communication to EventStoreDB.
Many threads can use an EventStoreDB client at the same time or a single thread can make many asynchronous requests.
Implementations
Creates a gRPC client to an EventStoreDB database.
pub async fn append_to_stream<Events>(
&self,
stream_name: impl AsRef<str>,
options: &AppendToStreamOptions,
events: Events
) -> Result<Result<WriteResult, WrongExpectedVersion>> where
Events: ToEvents + 'static,
pub async fn append_to_stream<Events>(
&self,
stream_name: impl AsRef<str>,
options: &AppendToStreamOptions,
events: Events
) -> Result<Result<WriteResult, WrongExpectedVersion>> where
Events: ToEvents + 'static,
Sends events to a given stream.
pub async fn set_stream_metadata(
&self,
stream_name: impl AsRef<str>,
options: &AppendToStreamOptions,
metadata: StreamMetadata
) -> Result<Result<WriteResult, WrongExpectedVersion>>
pub async fn read_stream<Count>(
&self,
stream_name: impl AsRef<str>,
options: &ReadStreamOptions,
count: Count
) -> Result<Count::Selection> where
Count: ToCount,
pub async fn read_stream<Count>(
&self,
stream_name: impl AsRef<str>,
options: &ReadStreamOptions,
count: Count
) -> Result<Count::Selection> where
Count: ToCount,
Reads events from a given stream. The reading can be done forward and backward.
Reads events for the system stream $all
. The reading can be done
forward and backward.
pub async fn get_stream_metadata(
&self,
stream_name: impl AsRef<str>,
options: &ReadStreamOptions
) -> Result<StreamMetadataResult>
pub async fn get_stream_metadata(
&self,
stream_name: impl AsRef<str>,
options: &ReadStreamOptions
) -> Result<StreamMetadataResult>
Reads a stream metadata.
pub async fn delete_stream(
&self,
stream_name: impl AsRef<str>,
options: &DeleteStreamOptions
) -> Result<Option<Position>>
pub async fn delete_stream(
&self,
stream_name: impl AsRef<str>,
options: &DeleteStreamOptions
) -> Result<Option<Position>>
Soft deletes a given stream. Makes use of Truncate before. When a stream is deleted, its Truncate before is set to the streams current last event number. When a soft deleted stream is read, the read will return a StreamNotFound. After deleting the stream, you are able to write to it again, continuing from where it left off.
pub async fn tombstone_stream(
&self,
stream_name: impl AsRef<str>,
options: &TombstoneStreamOptions
) -> Result<Option<Position>>
pub async fn tombstone_stream(
&self,
stream_name: impl AsRef<str>,
options: &TombstoneStreamOptions
) -> Result<Option<Position>>
Hard deletes a given stream. A hard delete writes a tombstone event to the stream, permanently deleting it. The stream cannot be recreated or written to again. Tombstone events are written with the event type ‘$streamDeleted’. When a hard deleted stream is read, the read will return a StreamDeleted.
pub async fn subscribe_to_stream(
&self,
stream_name: impl AsRef<str>,
options: &SubscribeToStreamOptions
) -> Subscription
pub async fn subscribe_to_stream(
&self,
stream_name: impl AsRef<str>,
options: &SubscribeToStreamOptions
) -> Subscription
Subscribes to a given stream. This kind of subscription specifies a
starting point (by default, the beginning of a stream). For a regular
stream, that starting point will be an event number. For the system
stream $all
, it will be a position in the transaction file
(see subscribe_to_all
). This subscription will fetch every event
until the end of the stream, then will dispatch subsequently written
events.
For example, if a starting point of 50 is specified when a stream has 100 events in it, the subscriber can expect to see events 51 through 100, and then any events subsequently written events until such time as the subscription is dropped or closed.
Like subscribe_to_stream
but specific to system $all
stream.
pub async fn create_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionOptions
) -> Result<()>
pub async fn create_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionOptions
) -> Result<()>
Creates a persistent subscription group on a stream.
Persistent subscriptions are special kind of subscription where the server remembers the state of the subscription. This allows for many different modes of operations compared to a regular or catchup subscription where the client holds the subscription state.
pub async fn create_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionToAllOptions
) -> Result<()>
pub async fn create_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionToAllOptions
) -> Result<()>
Creates a persistent subscription group on a the $all stream.
pub async fn update_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionOptions
) -> Result<()>
pub async fn update_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionOptions
) -> Result<()>
Updates a persistent subscription group on a stream.
pub async fn update_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionToAllOptions
) -> Result<()>
pub async fn update_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &PersistentSubscriptionToAllOptions
) -> Result<()>
Updates a persistent subscription group to $all.
pub async fn delete_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &DeletePersistentSubscriptionOptions
) -> Result<()>
pub async fn delete_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &DeletePersistentSubscriptionOptions
) -> Result<()>
Deletes a persistent subscription group on a stream.
pub async fn delete_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &DeletePersistentSubscriptionOptions
) -> Result<()>
pub async fn delete_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &DeletePersistentSubscriptionOptions
) -> Result<()>
Deletes a persistent subscription group on the $all stream.
pub async fn subscribe_to_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &SubscribeToPersistentSubscriptionOptions
) -> Result<PersistentSubscription>
pub async fn subscribe_to_persistent_subscription(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &SubscribeToPersistentSubscriptionOptions
) -> Result<PersistentSubscription>
Connects to a persistent subscription group on a stream.
pub async fn subscribe_to_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &SubscribeToPersistentSubscriptionOptions
) -> Result<PersistentSubscription>
pub async fn subscribe_to_persistent_subscription_to_all(
&self,
group_name: impl AsRef<str>,
options: &SubscribeToPersistentSubscriptionOptions
) -> Result<PersistentSubscription>
Connects to a persistent subscription group to $all stream.
pub async fn replay_parked_messages(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &ReplayParkedMessagesOptions
) -> Result<()>
pub async fn replay_parked_messages(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &ReplayParkedMessagesOptions
) -> Result<()>
Replays a persistent subscriptions parked events.
pub async fn list_all_persistent_subscriptions(
&self,
options: &ListPersistentSubscriptionsOptions
) -> Result<Vec<PersistentSubscriptionInfo>>
pub async fn list_all_persistent_subscriptions(
&self,
options: &ListPersistentSubscriptionsOptions
) -> Result<Vec<PersistentSubscriptionInfo>>
Lists all persistent subscriptions to date.
pub async fn list_persistent_subscriptions_for_stream(
&self,
stream_name: impl AsRef<str>,
options: &ListPersistentSubscriptionsOptions
) -> Result<Vec<PersistentSubscriptionInfo>>
pub async fn list_persistent_subscriptions_for_stream(
&self,
stream_name: impl AsRef<str>,
options: &ListPersistentSubscriptionsOptions
) -> Result<Vec<PersistentSubscriptionInfo>>
List all persistent subscriptions of a specific stream.
pub async fn get_persistent_subscription_info(
&self,
stream_name: impl AsRef<str>,
group_name: impl AsRef<str>,
options: &GetPersistentSubscriptionInfoOptions
) -> Result<PersistentSubscriptionInfo>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more
Wrap the input message T
in a tonic::Request
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more