[][src]Struct eventstore::Connection

pub struct Connection { /* fields omitted */ }

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]

Sends events to a given stream.

pub fn write_stream_metadata<S>(
    &self,
    stream: S,
    metadata: StreamMetadata
) -> WriteStreamMetadata where
    S: Into<Chars>, 
[src]

Sets the metadata for a stream.

pub fn read_event<S>(&self, stream: S, event_number: i64) -> ReadEvent where
    S: Into<Chars>, 
[src]

Reads a single event from a given stream.

pub fn read_stream_metadata<S>(&self, stream: S) -> ReadStreamMetadata where
    S: Into<Chars>, 
[src]

Gets the metadata of a stream.

pub fn start_transaction<S>(&self, stream: S) -> TransactionStart where
    S: Into<Chars>, 
[src]

Starts a transaction on a given stream.

pub fn read_stream<S>(&self, stream: S) -> ReadStreamEvents where
    S: Into<Chars>, 
[src]

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]

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]

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]

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]

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]

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]

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]

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]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T