pub struct EvidentSourceClient { /* private fields */ }Implementations§
Source§impl EvidentSourceClient
impl EvidentSourceClient
Sourcepub async fn new(addr: &str) -> Result<Self, Error>
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.
Sourcepub async fn with_credentials(
addr: &str,
credentials: Credentials,
) -> Result<Self, Error>
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?;pub async fn create_database( &mut self, database_name: String, ) -> Result<Database, Error>
pub async fn transact( &mut self, transaction_id: String, database_name: String, events: Vec<CloudEvent>, conditions: Vec<AppendCondition>, ) -> Result<TransactionResult, Error>
Sourcepub 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>
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
pub async fn delete_database( &mut self, database_name: String, ) -> Result<Database, Error>
pub async fn fetch_catalog( &mut self, ) -> Result<impl Stream<Item = Result<CatalogReply, Status>>, Error>
pub async fn fetch_latest_database( &mut self, database_name: String, ) -> Result<Database, Error>
pub async fn await_database( &mut self, database_name: String, at_revision: u64, ) -> Result<Database, Error>
pub async fn database_effective_at_timestamp( &mut self, database_name: String, at_timestamp: Timestamp, ) -> Result<Database, Error>
pub async fn subscribe_database_updates( &mut self, database_name: String, ) -> Result<impl Stream<Item = Result<DatabaseReply, Status>>, Error>
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>
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>
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>
pub async fn event_by_id( &mut self, database_name: String, revision: u64, stream: String, event_id: String, ) -> Result<EventQueryReply, Error>
pub async fn fetch_events_by_revisions( &mut self, database_name: String, event_revisions: Vec<u64>, ) -> Result<EventsReply, Error>
pub async fn list_state_view_definitions( &mut self, database_name: String, status: Option<StateViewStatus>, ) -> Result<impl Stream<Item = Result<ListStateViewDefinitionsReply, Status>>, Error>
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>
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>
Sourcepub 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>
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
Sourcepub async fn transact_async(
&mut self,
transaction_id: String,
database_name: String,
events: Vec<CloudEvent>,
conditions: Vec<AppendCondition>,
) -> Result<AsyncCommandResponse, Error>
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.
Sourcepub 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>
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
Sourcepub 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>
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.
Sourcepub 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>
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
Sourcepub async fn list_state_changes(
&mut self,
database_name: String,
) -> Result<impl Stream<Item = Result<ListStateChangesReply, Status>>, Error>
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.
Sourcepub async fn fetch_transaction_by_id(
&mut self,
database_name: String,
transaction_id: String,
) -> Result<FetchTransactionReply, Error>
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
impl Clone for EvidentSourceClient
Source§fn clone(&self) -> EvidentSourceClient
fn clone(&self) -> EvidentSourceClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for EvidentSourceClient
impl !RefUnwindSafe for EvidentSourceClient
impl Send for EvidentSourceClient
impl Sync for EvidentSourceClient
impl Unpin for EvidentSourceClient
impl !UnwindSafe for EvidentSourceClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request