EvidentSourceClient

Struct EvidentSourceClient 

Source
pub struct EvidentSourceClient { /* private fields */ }

Implementations§

Source§

impl EvidentSourceClient

Source

pub async fn new(addr: &str) -> Result<Self, Error>

Create a new client without authentication.

This only works if the server has allow_anonymous=true.

Source

pub async fn with_credentials( addr: &str, credentials: Credentials, ) -> Result<Self, Error>

Create a new client with authentication credentials.

§Examples
use evidentsource_client::{EvidentSourceClient, Credentials, DevModeCredentials};

// With bearer token (requires TLS)
let client = EvidentSourceClient::with_credentials(
    "https://api.example.com:50051",
    Credentials::BearerToken(my_jwt_token),
).await?;

// With DevMode credentials
let client = EvidentSourceClient::with_credentials(
    "http://localhost:50051",
    Credentials::DevMode(DevModeCredentials::new("dev-user")),
).await?;
Source

pub async fn create_database( &mut self, database_name: String, ) -> Result<Database, Error>

Source

pub async fn transact( &mut self, transaction_id: String, database_name: String, events: Vec<CloudEvent>, conditions: Vec<AppendCondition>, ) -> Result<TransactionResult, Error>

Source

pub async fn transact_with_options( &mut self, transaction_id: String, database_name: String, events: Vec<CloudEvent>, conditions: Vec<AppendCondition>, correlation_id: Option<String>, causation_id: Option<String>, ) -> Result<TransactionResult, Error>

Transact with optional correlation metadata.

§Arguments
  • correlation_id - Groups related events across a business flow (CloudEvents correlation extension)
  • causation_id - Tracks direct parent-child event relationships (CloudEvents correlation extension)

See: https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/correlation.md

Source

pub async fn delete_database( &mut self, database_name: String, ) -> Result<Database, Error>

Source

pub async fn fetch_catalog( &mut self, ) -> Result<impl Stream<Item = Result<CatalogReply, Status>>, Error>

Source

pub async fn fetch_latest_database( &mut self, database_name: String, ) -> Result<Database, Error>

Source

pub async fn await_database( &mut self, database_name: String, at_revision: u64, ) -> Result<Database, Error>

Source

pub async fn database_effective_at_timestamp( &mut self, database_name: String, at_timestamp: Timestamp, ) -> Result<Database, Error>

Source

pub async fn subscribe_database_updates( &mut self, database_name: String, ) -> Result<impl Stream<Item = Result<DatabaseReply, Status>>, Error>

Source

pub async fn scan_database_log( &mut self, database_name: String, start_at_revision: u64, include_event_detail: bool, ) -> Result<impl Stream<Item = Result<DatabaseLogReply, Status>>, Error>

Source

pub async fn scan_index_keys( &mut self, database_name: String, revision: u64, index_key_type: IndexKeyType, ) -> Result<impl Stream<Item = Result<IndexKeyScanReply, Status>>, Error>

Source

pub async fn query_events( &mut self, database_name: String, revision: u64, include_event_detail: bool, query: DatabaseQuery, ) -> Result<impl Stream<Item = Result<EventQueryReply, Status>>, Error>

Source

pub async fn event_by_id( &mut self, database_name: String, revision: u64, stream: String, event_id: String, ) -> Result<EventQueryReply, Error>

Source

pub async fn fetch_events_by_revisions( &mut self, database_name: String, event_revisions: Vec<u64>, ) -> Result<EventsReply, Error>

Source

pub async fn list_state_view_definitions( &mut self, database_name: String, status: Option<StateViewStatus>, ) -> Result<impl Stream<Item = Result<ListStateViewDefinitionsReply, Status>>, Error>

Source

pub async fn fetch_state_view_at_revision( &mut self, state_view_identity: Option<StateViewIdentity>, database_revision: u64, parameters: Option<ParameterBindings>, effective_time_end_at: Option<Timestamp>, ) -> Result<StateView, Error>

Source

pub async fn execute_state_change( &mut self, database_name: String, state_change_name: String, version: u64, last_seen_revision: Option<u64>, request: CommandRequest, transaction_id: Option<String>, ) -> Result<TransactionResult, Error>

Source

pub async fn execute_state_change_with_options( &mut self, database_name: String, state_change_name: String, version: u64, last_seen_revision: Option<u64>, request: CommandRequest, transaction_id: Option<String>, correlation_id: Option<String>, causation_id: Option<String>, ) -> Result<TransactionResult, Error>

Execute a state change with optional correlation metadata.

§Arguments
  • correlation_id - Groups related events across a business flow (CloudEvents correlation extension)
  • causation_id - Tracks direct parent-child event relationships (CloudEvents correlation extension)

See: https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/correlation.md

Source

pub async fn transact_async( &mut self, transaction_id: String, database_name: String, events: Vec<CloudEvent>, conditions: Vec<AppendCondition>, ) -> Result<AsyncCommandResponse, Error>

Transact asynchronously, returning a correlation ID.

The correlation ID can be used to track the result via Kafka.

Source

pub async fn transact_async_with_options( &mut self, transaction_id: String, database_name: String, events: Vec<CloudEvent>, conditions: Vec<AppendCondition>, correlation_id: Option<String>, causation_id: Option<String>, ) -> Result<AsyncCommandResponse, Error>

Transact asynchronously with optional correlation metadata.

See: https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/correlation.md

Source

pub async fn execute_state_change_async( &mut self, database_name: String, state_change_name: String, version: u64, last_seen_revision: Option<u64>, request: CommandRequest, transaction_id: Option<String>, ) -> Result<AsyncCommandResponse, Error>

Execute a state change asynchronously, returning a correlation ID.

The correlation ID can be used to track the result via Kafka.

Source

pub async fn execute_state_change_async_with_options( &mut self, database_name: String, state_change_name: String, version: u64, last_seen_revision: Option<u64>, request: CommandRequest, transaction_id: Option<String>, correlation_id: Option<String>, causation_id: Option<String>, ) -> Result<AsyncCommandResponse, Error>

Execute a state change asynchronously with optional correlation metadata.

See: https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/correlation.md

Source

pub async fn list_state_changes( &mut self, database_name: String, ) -> Result<impl Stream<Item = Result<ListStateChangesReply, Status>>, Error>

List state change definitions registered with the database.

Source

pub async fn fetch_transaction_by_id( &mut self, database_name: String, transaction_id: String, ) -> Result<FetchTransactionReply, Error>

Fetch a transaction by its ID.

Trait Implementations§

Source§

impl Clone for EvidentSourceClient

Source§

fn clone(&self) -> EvidentSourceClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EvidentSourceClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more