pub struct Server { /* private fields */ }Implementations§
Source§impl Server
impl Server
Sourcepub async fn bind(addr: impl ToSocketAddrs, data_dir: &Path) -> Result<Self>
pub async fn bind(addr: impl ToSocketAddrs, data_dir: &Path) -> Result<Self>
Bind the server to addr with data sharded under data_dir.
The shard count equals the number of performance cores.
§Errors
Returns an error if the address cannot be bound or a shard cannot start.
Sourcepub async fn bind_with_shards(
addr: impl ToSocketAddrs,
data_dir: &Path,
n_shards: usize,
workers: usize,
) -> Result<Self>
pub async fn bind_with_shards( addr: impl ToSocketAddrs, data_dir: &Path, n_shards: usize, workers: usize, ) -> Result<Self>
Bind the server with an explicit shard count and worker-pool size.
workers == 0 (default) keeps VSEARCH inline on the shard thread
(Personal AI default). workers > 0 dispatches VSEARCH to a tokio
blocking pool so KV ops do not queue behind multi-ms vector searches
(multi-tenant pattern, opt-in via --workers N on the CLI).
§Errors
Returns an error if the address cannot be bound or a shard cannot start.
Sourcepub async fn bind_full(
addr: impl ToSocketAddrs,
data_dir: &Path,
n_shards: usize,
workers: usize,
mmap_tier: bool,
) -> Result<Self>
pub async fn bind_full( addr: impl ToSocketAddrs, data_dir: &Path, n_shards: usize, workers: usize, mmap_tier: bool, ) -> Result<Self>
Full-knob constructor for the read-write path: shard count, worker
pool, and the opt-in mmap_tier flag (see --tier-mmap in the
server CLI). Other entry points delegate here with defaults.
§Errors
Returns an error if the address cannot be bound or a shard cannot start.
Sourcepub async fn bind_full_mmap(
addr: impl ToSocketAddrs,
data_dir: &Path,
n_shards: usize,
workers: usize,
mmap_tier: bool,
mmap_graph: bool,
) -> Result<Self>
pub async fn bind_full_mmap( addr: impl ToSocketAddrs, data_dir: &Path, n_shards: usize, workers: usize, mmap_tier: bool, mmap_graph: bool, ) -> Result<Self>
Sourcepub fn with_tenant_backend(self, backend: Arc<dyn TenantBackend>) -> Self
pub fn with_tenant_backend(self, backend: Arc<dyn TenantBackend>) -> Self
Install a multi-tenant backend on a server already built by one
of the bind* constructors. Builder-style for clarity at the
call site. When set, the RESP3 handler honours HELLO 3 AUTH
and scopes KV / vector ops by tenant id.
Sourcepub async fn bind_serve(
addr: impl ToSocketAddrs,
data_dir: &Path,
tier: QuantKind,
workers: usize,
) -> Result<Self>
pub async fn bind_serve( addr: impl ToSocketAddrs, data_dir: &Path, tier: QuantKind, workers: usize, ) -> Result<Self>
Bind the server in serve mode: a single shard over the offline-built
index at data_dir, read-only. Every mutation (KV and vector) is
rejected; the index is served at its clean resident footprint.
data_dir is a directory produced by skeg-tool build. tier is the
tier-1 quantisation built for the served index: QuantKind::Int8 or
QuantKind::Pq { m, k } (smaller footprint). workers > 0 enables
the VSEARCH dispatch pool described in [bind_with_shards].
§Errors
Returns an error if the address cannot be bound or the shard cannot start.
Sourcepub async fn bind_serve_full(
addr: impl ToSocketAddrs,
data_dir: &Path,
tier: QuantKind,
workers: usize,
mmap_tier: bool,
) -> Result<Self>
pub async fn bind_serve_full( addr: impl ToSocketAddrs, data_dir: &Path, tier: QuantKind, workers: usize, mmap_tier: bool, ) -> Result<Self>
Full-knob serve mode: like [bind_serve] plus the opt-in
mmap_tier flag that swaps the TurboQuant codes for a
memory-mapped view of tier.cache.bin at open.
§Errors
Returns an error if the address cannot be bound or the shard cannot start.
Sourcepub async fn bind_serve_full_mmap(
addr: impl ToSocketAddrs,
data_dir: &Path,
tier: QuantKind,
workers: usize,
mmap_tier: bool,
mmap_graph: bool,
) -> Result<Self>
pub async fn bind_serve_full_mmap( addr: impl ToSocketAddrs, data_dir: &Path, tier: QuantKind, workers: usize, mmap_tier: bool, mmap_graph: bool, ) -> Result<Self>
All-knobs serve mode. Adds mmap_graph to
bind_serve_full.
§Errors
Returns an error if the address cannot be bound or the shard cannot start.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Return the local address the server is listening on.
§Errors
Returns an error if the OS cannot retrieve the socket address.
Auto Trait Implementations§
impl !Freeze for Server
impl !RefUnwindSafe for Server
impl !UnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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::Request