[−][src]Struct eventstore::Connection
Represents a connection to a single node. Client
maintains a full duplex
connection to the EventStore server. An EventStore connection operates
quite differently than say a SQL connection. Normally when you use an
EventStore connection you want to keep the connection open for a much
longer of time than when you use a SQL connection.
Another difference is that with the EventStore connection, all operations are handled in a full async manner (even if you call the synchronous behaviors). Many threads can use an EventStore connection at the same time or a single thread can make many asynchronous requests. To get the most performance out of the connection, it is generally recommended to use it in this way.
Methods
impl Connection
[src]
pub fn builder() -> ConnectionBuilder
[src]
Return a connection builder.
pub fn write_events<S>(&self, stream: S) -> WriteEvents where
S: Into<Chars>,
[src]
S: Into<Chars>,
Sends events to a given stream.
pub fn write_stream_metadata<S>(
&self,
stream: S,
metadata: StreamMetadata
) -> WriteStreamMetadata where
S: Into<Chars>,
[src]
&self,
stream: S,
metadata: StreamMetadata
) -> WriteStreamMetadata where
S: Into<Chars>,
Sets the metadata for a stream.
pub fn read_event<S>(&self, stream: S, event_number: i64) -> ReadEvent where
S: Into<Chars>,
[src]
S: Into<Chars>,
Reads a single event from a given stream.
pub fn read_stream_metadata<S>(&self, stream: S) -> ReadStreamMetadata where
S: Into<Chars>,
[src]
S: Into<Chars>,
Gets the metadata of a stream.
pub fn start_transaction<S>(&self, stream: S) -> TransactionStart where
S: Into<Chars>,
[src]
S: Into<Chars>,
Starts a transaction on a given stream.
pub fn read_stream<S>(&self, stream: S) -> ReadStreamEvents where
S: Into<Chars>,
[src]
S: Into<Chars>,
Reads events from a given stream. The reading can be done forward and backward.
pub fn read_all(&self) -> ReadAllEvents
[src]
Reads events for the system stream $all
. The reading can be done
forward and backward.
pub fn delete_stream<S>(&self, stream: S) -> DeleteStream where
S: Into<Chars>,
[src]
S: Into<Chars>,
Deletes a given stream. By default, the server performs a soft delete, More information can be found on the [Deleting streams and events] page.
pub fn subcribe_to_stream<S>(&self, stream_id: S) -> SubscribeToStream where
S: Into<Chars>,
[src]
S: Into<Chars>,
Subscribes to a given stream. You will get notified of each new events written to this stream.
pub fn subscribe_to_stream_from<S>(&self, stream: S) -> RegularCatchupSubscribe where
S: Into<Chars>,
[src]
S: Into<Chars>,
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_from
). 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 subsequenttly written events until such time as the subscription is dropped or closed.
pub fn subscribe_to_all_from(&self) -> AllCatchupSubscribe
[src]
Like subscribe_to_stream_from
but specific to system $all
stream.
pub fn create_persistent_subscription<S>(
&self,
stream_id: S,
group_name: S
) -> CreatePersistentSubscription where
S: Into<Chars>,
[src]
&self,
stream_id: S,
group_name: S
) -> CreatePersistentSubscription where
S: Into<Chars>,
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 fn update_persistent_subscription<S>(
&self,
stream_id: S,
group_name: S
) -> UpdatePersistentSubscription where
S: Into<Chars>,
[src]
&self,
stream_id: S,
group_name: S
) -> UpdatePersistentSubscription where
S: Into<Chars>,
Updates a persistent subscription group on a stream.
pub fn delete_persistent_subscription<S>(
&self,
stream_id: S,
group_name: S
) -> DeletePersistentSubscription where
S: Into<Chars>,
[src]
&self,
stream_id: S,
group_name: S
) -> DeletePersistentSubscription where
S: Into<Chars>,
Deletes a persistent subscription group on a stream.
pub fn connect_persistent_subscription<S>(
&self,
stream_id: S,
group_name: S
) -> ConnectToPersistentSubscription where
S: Into<Chars>,
[src]
&self,
stream_id: S,
group_name: S
) -> ConnectToPersistentSubscription where
S: Into<Chars>,
Connects to a persistent subscription group on a stream.
pub fn shutdown(self)
[src]
Closes the connection to the server.
When closing a connection, a Connection
might have ongoing operations
running. shutdown
makes sure the Connection
has handled
everything properly when returning.
shutdown
blocks the current thread.
Auto Trait Implementations
impl Send for Connection
impl Sync for Connection
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,