Skip to main content

Server

Struct Server 

Source
pub struct Server { /* private fields */ }

Implementations§

Source§

impl Server

Source

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.

Source

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.

Source

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.

Source

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>

All-knobs constructor for the read-write path. Adds mmap_graph to bind_full.

§Errors

Returns an error if the address cannot be bound or a shard cannot start.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn n_shards(&self) -> usize

Number of shards backing this server.

Source

pub async fn run(self) -> Result<()>

Accept connections and handle them until an I/O error on accept.

§Errors

Returns the first error from TcpListener::accept.

Source

pub async fn run_resp3(self) -> Result<()>

Like run, but speaks RESP3 (Redis wire) on the listener instead of the skeg binary protocol. Same shard set, same storage, different encoding.

§Errors

Returns the first error from TcpListener::accept.

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

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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> 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