pub struct UdbClient { /* private fields */ }Expand description
A connected UDB data-plane client bound to one identity.
Implementations§
Source§impl UdbClient
impl UdbClient
Sourcepub async fn connect(
endpoint: impl Into<String>,
meta: Metadata,
) -> Result<Self, Error>
pub async fn connect( endpoint: impl Into<String>, meta: Metadata, ) -> Result<Self, Error>
Connect to a broker’s data-plane listener (:50051 by default).
Note the port: UDB runs SEPARATE listeners with different authorization models — the data plane authorizes through Casbin, while the native service listener uses scope-based endpoint security. A credential accepted by one is not automatically accepted by the other, and the mismatch presents as a permissions error rather than a wrong-address error.
Sourcepub fn with_channel(channel: Channel, meta: Metadata) -> Self
pub fn with_channel(channel: Channel, meta: Metadata) -> Self
Wrap an already-configured channel — use this for TLS, custom timeouts, load balancing, or interceptors.
Sourcepub fn with_audit(
&self,
purpose: impl Into<String>,
correlation_id: impl Into<String>,
) -> Self
pub fn with_audit( &self, purpose: impl Into<String>, correlation_id: impl Into<String>, ) -> Self
A copy of this client carrying request-scoped audit fields.
Identity is intentionally not settable here; see Metadata.
Sourcepub fn with_bearer_token(&self, token: impl Into<String>) -> Self
pub fn with_bearer_token(&self, token: impl Into<String>) -> Self
Replace the bearer credential, e.g. after a token refresh.
Sourcepub fn request<T>(&self, message: T) -> Result<Request<T>, Status>
pub fn request<T>(&self, message: T) -> Result<Request<T>, Status>
Wrap a message in a request carrying this connection’s metadata.
Public so callers can reach an RPC this wrapper does not expose yet without hand-rolling — and without hand-rolling the headers.
Sourcepub fn raw(&mut self) -> &mut DataBrokerClient<Channel>
pub fn raw(&mut self) -> &mut DataBrokerClient<Channel>
The raw generated client, for RPCs this wrapper does not cover.
Pair it with UdbClient::request so metadata is still applied.
Sourcepub fn with_policy(&self, policy: CallPolicy) -> Self
pub fn with_policy(&self, policy: CallPolicy) -> Self
Apply a deadline/retry policy to every call this client makes.
Sourcepub async fn select(
&mut self,
req: SelectRequest,
) -> Result<RecordSet, UdbError>
pub async fn select( &mut self, req: SelectRequest, ) -> Result<RecordSet, UdbError>
Read. Retry policy comes from the contract, not this wrapper.
Sourcepub async fn upsert(
&mut self,
req: UpsertRequest,
) -> Result<MutationResponse, UdbError>
pub async fn upsert( &mut self, req: UpsertRequest, ) -> Result<MutationResponse, UdbError>
Write. The contract declares it replayable, so it retries.
Sourcepub async fn update(
&mut self,
req: UpdateRequest,
) -> Result<MutationResponse, UdbError>
pub async fn update( &mut self, req: UpdateRequest, ) -> Result<MutationResponse, UdbError>
Write. Contract-declared replayable.
Sourcepub async fn delete(
&mut self,
req: DeleteRequest,
) -> Result<MutationResponse, UdbError>
pub async fn delete( &mut self, req: DeleteRequest, ) -> Result<MutationResponse, UdbError>
Write. Contract-declared replayable.
Sourcepub async fn bulk_cas(
&mut self,
req: BulkCasRequest,
) -> Result<BulkCasResponse, UdbError>
pub async fn bulk_cas( &mut self, req: BulkCasRequest, ) -> Result<BulkCasResponse, UdbError>
Compare-and-swap. The contract does NOT declare it replayable: a CAS that timed out may have committed, and a repeat would compare against state its own first attempt wrote.
Sourcepub async fn vector_search(
&mut self,
req: VectorSearchRequest,
) -> Result<VectorSet, UdbError>
pub async fn vector_search( &mut self, req: VectorSearchRequest, ) -> Result<VectorSet, UdbError>
Read.
Sourcepub async fn vector_upsert(
&mut self,
req: VectorUpsertRequest,
) -> Result<MutationResponse, UdbError>
pub async fn vector_upsert( &mut self, req: VectorUpsertRequest, ) -> Result<MutationResponse, UdbError>
Write. Not contract-declared replayable.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for UdbClient
impl !RefUnwindSafe for UdbClient
impl !UnwindSafe for UdbClient
impl Send for UdbClient
impl Sync for UdbClient
impl Unpin for UdbClient
impl UnsafeUnpin for UdbClient
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