Skip to main content

DataClient

Struct DataClient 

Source
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

Source

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.

Source

pub fn over(transport: SessionTransport) -> Self

Build a data client over an existing transport, composing a control client over the same channel + session id.

Source

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.

Source

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.

Source

pub async fn bind_tenant(&self, t: TenantId) -> Result<()>

Bind a tenant scope to this session (sticky form).

Source

pub async fn unbind_tenant(&self) -> Result<()>

Clear the bound tenant.

Source

pub async fn tenant(&self) -> Result<Option<TenantId>>

The tenant currently bound, if any.

Source

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 executedo_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.

Source

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.

Source

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.

Source

pub async fn search(&self, request: SearchRequest) -> Result<Vec<RecordBatch>>

Run a vector search and return the terminal hydrated batches.

Source

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.

Source

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.

Source

pub async fn fine_tune_status(&self, id: &FineTuneJobId) -> Result<String>

Current status string for a fine-tune job, looked up by id.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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

Source§

fn clone(&self) -> DataClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
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<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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