Skip to main content

ChalkClient

Struct ChalkClient 

Source
pub struct ChalkClient { /* private fields */ }
Expand description

An HTTP/REST client for the Chalk feature store.

Implementations§

Source§

impl ChalkClient

Source

pub fn new() -> ChalkClientBuilder

Start building a new ChalkClient.

Source§

impl ChalkClient

Source

pub async fn query( &self, inputs: HashMap<String, Value>, outputs: Vec<String>, options: QueryOptions, ) -> Result<OnlineQueryResponse>

Query features online (single entity, JSON request/response).

§Arguments
  • inputs — Known feature values, e.g. {"user.id": 42}.
  • outputs — Which features to compute, e.g. ["user.age", "user.name"].
  • options — Optional settings (staleness, tags, etc.).
Source

pub async fn query_bulk( &self, inputs: &RecordBatch, outputs: Vec<String>, options: QueryOptions, ) -> Result<BulkQueryResult>

Query features in bulk using the Chalk feather protocol.

You provide inputs as an Arrow RecordBatch (one column per input feature, one row per entity) and get back a BulkQueryResult containing the output features as raw Feather bytes.

Source

pub async fn offline_query( &self, params: OfflineQueryParams, ) -> Result<OfflineQueryResponse>

Run an offline query using the builder pattern.

§Example
let response = client.offline_query(
    OfflineQueryParams::new()
        .with_input("user.id", vec![serde_json::json!(1), serde_json::json!(2)])
        .with_output("user.email")
).await?;
Source

pub async fn offline_query_raw( &self, request: OfflineQueryRequest, ) -> Result<OfflineQueryResponse>

Run an offline query with a raw OfflineQueryRequest.

Source

pub async fn get_offline_query_status( &self, job_id: &str, ) -> Result<GetOfflineQueryStatusResponse>

Get the status of an offline query job.

Source

pub async fn wait_for_offline_query( &self, response: &OfflineQueryResponse, timeout: Option<Duration>, ) -> Result<()>

Wait for an offline query job to complete.

Polls get_offline_query_status every second until the job reaches "COMPLETED" or "FAILED" status.

Source

pub async fn get_offline_query_download_urls( &self, response: &OfflineQueryResponse, timeout: Option<Duration>, ) -> Result<Vec<String>>

Get download URLs for an offline query’s result Parquet files.

Source

pub async fn upload_features( &self, features: &RecordBatch, ) -> Result<UploadFeaturesResult>

Upload feature values to the Chalk feature store.

§Arguments
  • features — An Arrow RecordBatch where each column is a feature (column names are feature FQNs like "user.age").
Source

pub async fn upload_features_map( &self, inputs: HashMap<String, Vec<Value>>, ) -> Result<UploadFeaturesResult>

Upload feature values from a map of feature names to value arrays.

§Example
let inputs = HashMap::from([
    ("user.id".to_string(), vec![serde_json::json!(1), serde_json::json!(2)]),
    ("user.name".to_string(), vec![serde_json::json!("Alice"), serde_json::json!("Bob")]),
]);
let result = client.upload_features_map(inputs).await?;
Source

pub fn environment_id(&self) -> &str

Returns the resolved environment ID.

Source

pub fn query_server(&self) -> &str

Returns the resolved query server URL.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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