Skip to main content

StateletClient

Struct StateletClient 

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

Async gRPC client for Statelet.

Implementations§

Source§

impl StateletClient

Source

pub async fn connect(addr: &str) -> Result<Self, Error>

Connect to a Statelet node.

Source

pub fn set_default_cf(&mut self, cf: u32)

Set the default column family id.

Source

pub async fn ping(&mut self) -> Result<String, Status>

Liveness check. Returns “PONG”.

Source

pub async fn put( &mut self, key: &[u8], value: &[u8], cf: Option<u32>, ) -> Result<(), Status>

Write a single key-value pair.

Source

pub async fn get( &mut self, key: &[u8], cf: Option<u32>, ) -> Result<Option<Vec<u8>>, Status>

Read the value for a key. Returns None if not found.

Source

pub async fn delete( &mut self, key: &[u8], cf: Option<u32>, ) -> Result<(), Status>

Delete a key.

Source

pub async fn merge( &mut self, key: &[u8], value: &[u8], cf: Option<u32>, ) -> Result<(), Status>

Merge an operand into the existing value.

Source

pub async fn batch_write(&mut self, ops: Vec<WriteOp>) -> Result<(), Status>

Atomically apply a batch of write operations.

Source

pub async fn scan( &mut self, prefix: &[u8], cursor: Option<&[u8]>, limit: u32, cf: Option<u32>, ) -> Result<(Vec<(Vec<u8>, Vec<u8>)>, Option<Vec<u8>>), Status>

Scan keys with an optional prefix filter. Returns entries and next cursor.

Source

pub async fn delete_by_prefix( &mut self, prefix: &[u8], cf: Option<u32>, ) -> Result<u32, Status>

Delete all keys matching a prefix. Returns the number of keys deleted.

Source

pub async fn create_vector_index( &mut self, name: &str, config: VectorIndexConfig, ) -> Result<(), Status>

Create or reconfigure an HNSW vector index.

Source

pub async fn drop_vector_index(&mut self, name: &str) -> Result<(), Status>

Drop an HNSW vector index.

Source

pub async fn vector_put( &mut self, index_name: &str, vector_id: u64, vector: Vec<f32>, ) -> Result<(), Status>

Insert or update a vector.

Source

pub async fn vector_delete( &mut self, index_name: &str, vector_id: u64, ) -> Result<(), Status>

Remove a vector from the index.

Approximate nearest neighbor search.

Source

pub async fn vector_search_reranked( &mut self, index_name: &str, query: Vec<f32>, k: u32, ef_search: Option<u32>, rerank: Option<RerankSpec>, ) -> Result<Vec<VectorSearchResult>, Status>

Approximate nearest neighbor search with an optional second-stage reranker.

Pass a proto::RerankSpec to enable the cross-encoder or model-free score-fusion rerank over an over-fetched candidate window — the analogue of Weaviate .with_additional({rerank}) / Pinecone inference.rerank. None ⇒ no rerank (identical to Self::vector_search). See docs/reranking.md for the two models and signal_blend semantics.

Source

pub async fn vector_search_grouped( &mut self, index_name: &str, query: Vec<f32>, k: u32, ef_search: Option<u32>, group: GroupSpec, ) -> Result<Vec<VectorSearchResult>, Status>

Approximate nearest neighbor search with result grouping / field-collapse (epic #1427).

Collapse results to at most GroupSpec::group_size hits per distinct value of GroupSpec::field, returning up to GroupSpec::groups distinct group keys (each result’s value surfaced on VectorSearchResult::group_key). Grouping is exact on single-shard deployments and best-effort across shards (tune via GroupSpec::overfetch). Grouping is mutually exclusive with MMR. The analogue of Qdrant query_groups / Weaviate groupBy / Milvus grouping_field.

Source

pub async fn rerank_validate( &mut self, index_name: &str, rerank: RerankSpec, ) -> Result<(), Status>

Dry-run pre-flight validation of a proto::RerankSpec.

Issues a validate_only vector search that validates the passage_field template (and, for model = "cross-encoder", that a reranker is loaded on the gateway) without executing the search. Returns Ok(()) when the spec is valid; the underlying InvalidArgument / FailedPrecondition tonic::Status otherwise. Mirrors Weaviate’s “property exists?” / Pinecone’s “rank_fields valid?” pre-flight.

Source

pub async fn vector_get( &mut self, index_name: &str, vector_id: u64, ) -> Result<Option<Vec<f32>>, Status>

Retrieve a stored vector by id.

Source

pub async fn graph_query( &mut self, cypher: &str, options: GraphQueryOptions, ) -> Result<GraphQueryResult, Status>

Run a read-only openCypher-subset query.

Gateway-only: the gateway parses and plans the query, then compiles it to engine traversal primitives. The subset covers MATCH path patterns, WHERE over node properties, RETURN / ORDER BY / LIMIT, a bitemporal AS OF <valid>[, <tx>] clause, and the retrieval procedures db.vectorSearch / db.hybridSearch / db.graphRag. CREATE / MERGE are rejected.

GraphQueryOptions::default() means “let the gateway decide”: the default graph, no extra row cap and no temporal filter on either axis.

Named query parameters ($q) parse but are not resolvable yet, so a vector-seeded procedure needs an inline literal — db.vectorSearch([0.1, 0.2, ...], 5).

Source

pub async fn subscribe_committed<H, E>( &mut self, opts: SubscribeCommittedOptions<'_>, handler: H, ) -> Result<(), ConsumeError<E>>
where H: FnMut(CommittedChange) -> Result<bool, E>,

Consume the durable, ordered, resumable committed change-feed (CDC).

Invokes handler for each cdc::CommittedChange in stable Raft-offset order, driving the canonical Phase-5b algorithm: client-managed offsets (supply subscription_id + checkpoint to resume across restarts), bootstrap-on-compacted via a paged Self::scan, heartbeat-advances- checkpoint, reconnect-on-disconnect from last_offset + 1, and at-least-once delivery (with auto_commit, each offset is committed after handler returns Ok(true)).

handler returns Ok(true) to continue, Ok(false) to stop cleanly, or Err(e) to stop with cdc::ConsumeError::Handler. The future runs until the handler stops it (the live tail never ends on its own).

Trait Implementations§

Source§

impl FeedTransport for StateletClient

Source§

type Stream = GrpcFeedStream

Source§

fn open_feed<'life0, 'life1, 'async_trait>( &'life0 mut self, shard_id: u64, from_offset: u64, cf: u32, key_prefix: &'life1 [u8], include_values: bool, ) -> Pin<Box<dyn Future<Output = Result<Self::Stream, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open a server-streaming committed feed from from_offset.
Source§

fn scan_page<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, prefix: &'life1 [u8], cursor: Option<&'life2 [u8]>, limit: u32, cf: u32, ) -> Pin<Box<dyn Future<Output = Result<(Vec<(Vec<u8>, Vec<u8>)>, Option<Vec<u8>>), Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Page the scan; returns (entries, next_cursor) with next_cursor = None when there are no more results.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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