pub struct DataClient { /* private fields */ }Expand description
A data-plane client backed by a remote engine over gRPC + Flight SQL.
Cheap to clone: it holds the cloneable transport and the composed
CatalogClient (which shares the same transport).
Implementations§
Source§impl DataClient
impl DataClient
Sourcepub async fn connect(endpoint: impl Into<Endpoint>) -> Result<Self>
pub async fn connect(endpoint: impl Into<Endpoint>) -> Result<Self>
Connect to a jammi.v1 gRPC endpoint and mint a fresh session id. The
composed control client shares the same transport (and session id), so a
tenant bound through Self::bind_tenant is observed by every data verb.
Sourcepub fn over(transport: SessionTransport) -> Self
pub fn over(transport: SessionTransport) -> Self
Build a data client over an existing transport, composing a control client over the same channel + session id.
Sourcepub fn catalog(&self) -> &CatalogClient
pub fn catalog(&self) -> &CatalogClient
The composed control-plane client over the same session — the source/ model registry, channel, mutable-table, topic-admin, and tenant verbs.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
The opaque session id the server keys tenant state against. The Flight SQL lane stamps this same id so a bound-tenant query scopes correctly.
Sourcepub async fn bind_tenant(&self, t: TenantId) -> Result<()>
pub async fn bind_tenant(&self, t: TenantId) -> Result<()>
Bind a tenant scope to this session (sticky form).
Sourcepub async fn unbind_tenant(&self) -> Result<()>
pub async fn unbind_tenant(&self) -> Result<()>
Clear the bound tenant.
Sourcepub async fn sql(&self, query: &str) -> Result<Vec<RecordBatch>>
pub async fn sql(&self, query: &str) -> Result<Vec<RecordBatch>>
Execute a SQL query over the Flight SQL lane and collect the terminal batches.
sql does not ride a typed gRPC verb — per ADR-01 §3.2 the Flight SQL
surface carries query/result. So this opens a FlightSqlServiceClient
over the same tonic channel the typed-RPC verbs use, stamps the
SESSION_HEADER with Self::session_id — the identical id
bind_tenant bound the tenant scope against — so the server’s
TenantBoundProvider resolves this query to that bound tenant, then runs
execute → do_get(ticket) per endpoint and concatenates the streamed
batches. Stamping the bound session id (not a fresh one) is what keeps a
--tenant A query scoped to tenant A rather than silently unscoped.
Sourcepub async fn generate_embeddings(
&self,
source_id: &str,
model_id: &str,
columns: &[String],
key_column: &str,
modality: Modality,
cache: CachePolicy,
) -> Result<(ResultTableRecord, CacheOutcome)>
pub async fn generate_embeddings( &self, source_id: &str, model_id: &str, columns: &[String], key_column: &str, modality: Modality, cache: CachePolicy, ) -> Result<(ResultTableRecord, CacheOutcome)>
Generate embeddings for columns of a source with the given model and
modality, persisting one vector per row.
Sourcepub async fn encode_query(
&self,
model_id: &str,
input: QueryInput,
modality: Modality,
) -> Result<Vec<f32>>
pub async fn encode_query( &self, model_id: &str, input: QueryInput, modality: Modality, ) -> Result<Vec<f32>>
Encode a single query into a vector with the given model.
Sourcepub async fn search(&self, request: SearchRequest) -> Result<Vec<RecordBatch>>
pub async fn search(&self, request: SearchRequest) -> Result<Vec<RecordBatch>>
Run a vector search and return the terminal hydrated batches.
Sourcepub async fn infer(
&self,
source_id: &str,
model_id: &str,
task: ModelTask,
content_columns: &[String],
key_column: &str,
cache: CachePolicy,
) -> Result<(Vec<RecordBatch>, CacheOutcome)>
pub async fn infer( &self, source_id: &str, model_id: &str, task: ModelTask, content_columns: &[String], key_column: &str, cache: CachePolicy, ) -> Result<(Vec<RecordBatch>, CacheOutcome)>
Run inference on a registered source using a model.
Sourcepub async fn fine_tune(
&self,
source: &str,
base_model: &str,
columns: &[String],
method: FineTuneMethod,
task: ModelTask,
config: Option<FineTuneConfig>,
) -> Result<FineTuneJobId>
pub async fn fine_tune( &self, source: &str, base_model: &str, columns: &[String], method: FineTuneMethod, task: ModelTask, config: Option<FineTuneConfig>, ) -> Result<FineTuneJobId>
Start a fine-tuning job and return its id. Poll completion with
Self::fine_tune_status.
Sourcepub async fn fine_tune_status(&self, id: &FineTuneJobId) -> Result<String>
pub async fn fine_tune_status(&self, id: &FineTuneJobId) -> Result<String>
Current status string for a fine-tune job, looked up by id.
Sourcepub async fn eval_embeddings(
&self,
source_id: &str,
embedding_table: Option<&str>,
golden_source: &str,
k: usize,
cohorts: &HashMap<String, BTreeMap<String, String>>,
) -> Result<EmbeddingEvalReport>
pub async fn eval_embeddings( &self, source_id: &str, embedding_table: Option<&str>, golden_source: &str, k: usize, cohorts: &HashMap<String, BTreeMap<String, String>>, ) -> Result<EmbeddingEvalReport>
Evaluate embedding quality against golden relevance judgments.
Sourcepub async fn eval_per_query(
&self,
eval_run_id: &str,
) -> Result<Vec<PerQueryEvalRecord>>
pub async fn eval_per_query( &self, eval_run_id: &str, ) -> Result<Vec<PerQueryEvalRecord>>
Read back the persisted per-query eval records for a run.
Sourcepub async fn eval_inference(
&self,
model_id: &str,
source_id: &str,
columns: &[String],
task: EvalTask,
golden_source: &str,
label_column: &str,
) -> Result<InferenceEvalReport>
pub async fn eval_inference( &self, model_id: &str, source_id: &str, columns: &[String], task: EvalTask, golden_source: &str, label_column: &str, ) -> Result<InferenceEvalReport>
Evaluate inference quality against golden labels.
Sourcepub async fn eval_compare(
&self,
embedding_tables: &[String],
source_id: &str,
golden_source: &str,
k: usize,
) -> Result<CompareEvalReport>
pub async fn eval_compare( &self, embedding_tables: &[String], source_id: &str, golden_source: &str, k: usize, ) -> Result<CompareEvalReport>
Compare multiple embedding tables side-by-side.
Sourcepub async fn publish(
&self,
topic: &TopicDefinition,
batch: RecordBatch,
) -> Result<Offset, TriggerError>
pub async fn publish( &self, topic: &TopicDefinition, batch: RecordBatch, ) -> Result<Offset, TriggerError>
Publish one batch to a topic under the session’s tenant scope, returning the assigned offset.
Sourcepub async fn subscribe(
&self,
topic: &TopicDefinition,
predicate: Predicate,
from_offset: Option<Offset>,
replay_only: bool,
) -> Result<Pin<Box<dyn Stream<Item = Result<DeliveredBatch, TriggerError>> + Send>>, TriggerError>
pub async fn subscribe( &self, topic: &TopicDefinition, predicate: Predicate, from_offset: Option<Offset>, replay_only: bool, ) -> Result<Pin<Box<dyn Stream<Item = Result<DeliveredBatch, TriggerError>> + Send>>, TriggerError>
Subscribe to a topic, returning a transport-neutral stream of delivered
batches. The stream replays from from_offset (or the live tail when
None) and then tails live, scoped to the session’s tenant. When
replay_only is set the server drives its finite drain and closes the
stream rather than holding open to tail live batches.
Sourcepub async fn audit_log(
&self,
records: Vec<PerQueryAudit>,
) -> Result<(), AuditError>
pub async fn audit_log( &self, records: Vec<PerQueryAudit>, ) -> Result<(), AuditError>
Sign and persist a batch of audit records; publishes them to the audit topic.
Sourcepub async fn audit_fetch_by_query_id(
&self,
query_id: Uuid,
) -> Result<Option<PerQueryAudit>, AuditError>
pub async fn audit_fetch_by_query_id( &self, query_id: Uuid, ) -> Result<Option<PerQueryAudit>, AuditError>
Fetch one audit record by query id (tenant-scoped).
Sourcepub async fn audit_fetch_recent(
&self,
limit: usize,
) -> Result<Vec<PerQueryAudit>, AuditError>
pub async fn audit_fetch_recent( &self, limit: usize, ) -> Result<Vec<PerQueryAudit>, AuditError>
Fetch the most recent audit records (tenant-scoped), newest first.
Trait Implementations§
Source§impl Clone for DataClient
impl Clone for DataClient
Source§fn clone(&self) -> DataClient
fn clone(&self) -> DataClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for DataClient
impl !RefUnwindSafe for DataClient
impl !UnwindSafe for DataClient
impl Send for DataClient
impl Sync for DataClient
impl Unpin for DataClient
impl UnsafeUnpin for DataClient
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.