Skip to main content

Service

Struct Service 

Source
pub struct Service {
    pub max_page: NonZeroU32,
    pub append_prune_limits: AppendPruneLimits,
    pub query: Option<Prepared>,
    pub changes: Settings,
    pub embed_search_bound: Option<NonZeroU64>,
    /* private fields */
}

Fields§

§max_page: NonZeroU32§append_prune_limits: AppendPruneLimits§query: Option<Prepared>§changes: Settings

The named limits of changes.list.

§embed_search_bound: Option<NonZeroU64>

The most vectors one text search compares: query_scan_records.

Implementations§

Source§

impl Service

Source

pub fn new(storage: Storage, max_page: NonZeroU32) -> Result<Self, Failure>

§Errors

Propagates any error from reader.

Source

pub fn with_query( storage: Storage, max_page: NonZeroU32, query: Option<Prepared>, ) -> Result<Self, Failure>

Build the service with optional prepared query settings.

§Errors

Returns a storage reader, query admission, or continuation-key refusal.

Source

pub fn with_lys(self, gate: Gate) -> Self

Decide every request through Lys (ACCESS-001 R2): a connection presents its pass with session.pass, and nothing in configuration grants a writer.

Source

pub fn with_placer(self, placer: Placer) -> Result<Self, Failure>

Place this store’s collections and branches in Lys under its database (serve/placement.rs): every one it holds now, handed to placer at once, then each new one after the write that makes it commits.

§Errors

The store’s branches or collections could not be listed.

Source

pub fn present(&self, token: &str) -> Result<Value, Failure>

Verify a pass a connection presents, answering {holder, expires}.

§Errors

Refuses with the pass’s stable name, or invalid_operation when this service is not served through Lys.

Source

pub fn run_drafts( &self, token: Option<&str>, run: &DraftsRun, ) -> Result<Value, Failure>

Run one page of the drafts Lys approved for this database, with the connection’s pass token as the connector’s (ACCESS-001 R2).

§Errors

pass_missing without a pass, invalid_operation when this service is not served through Lys, or where the run stopped, by name.

Source

pub fn follow( &self, branch: &str, expires: Option<u64>, clock: impl Fn() -> SystemTime, send: impl FnMut(&Value) -> Result<()>, ) -> Result<Failure>

Follow branch’s head for one connection, giving each head frame to send, with the connection’s pass expiring at expires seconds since the epoch as clock reads it (serve/follow.rs). The route was decided before this, as head.follow.

Answers the refusal that ends the follow.

§Errors

The first error send returns: the client went away.

Source

pub fn authorize( &self, token: Option<&str>, operation: &Operation, words: Option<&str>, ) -> Result<(), Failure>

Decide operation from the connection’s pass before it is dispatched. words are the request’s exact text, drafted with it when Lys holds it for approval. A service without a Lys gate is its owner’s, and decides nothing.

§Errors

Returns the first refusal of the request’s subjects.

Source

pub fn start_release(&mut self, settings: Settings) -> Result<(), Failure>

Starts the release thread over this service’s storage. A write that finds a release running waits for it rather than being told busy.

§Errors

The decisions left at open could not be read.

Source

pub fn start_embedding( &mut self, worker: Arc<dyn Worker>, bounds: Bounds, writer_wait: Duration, ) -> Result<(), Failure>

Starts the embedding thread over this service’s storage with worker; the worker starts on that thread, off the serving path.

§Errors

The declared fields could not be read, or the thread not started.

Source

pub fn start_embedding_with( &mut self, worker: Arc<dyn Worker>, bounds: Bounds, writer_wait: Duration, restart: Restart, ) -> Result<(), Failure>

As Self::start_embedding, with a worker that dies started again as restart says (EWR1).

§Errors

The declared fields could not be read, or the thread not started.

Source

pub fn start_embedding_apart( &mut self, worker: Arc<dyn Worker>, questions: Option<Arc<dyn Worker>>, bounds: Bounds, writer_wait: Duration, restart: Restart, ) -> Result<(), Failure>

As Self::start_embedding_with, with every text search’s question asked of questions when given, a worker of its own that the walk never uses (SL1). The question worker never commits, so it never takes the admission; the walk’s commits go through it (JOIN1).

§Errors

The declared fields could not be read, or the thread not started.

Source

pub const fn embedding(&self) -> Option<&Driver>

The embedding thread, once started.

Source

pub const fn releaser(&self) -> Option<&Releaser>

The release thread, once started.

Source

pub fn dispatch(&self, operation: Operation) -> Result<Value, ResponseFailure>

§Errors

Returns a refusal with mutation context if dispatch fails. The answer as a value, for a caller in this process. A stored body in a query.run or changes.list answer is equal as a value to what was written, but a value cannot keep a number’s text (1e2 becomes 1e+2): the transport answers through Self::dispatch_text (NB1).

Source

pub fn dispatch_waiting( &self, operation: Operation, timeout: Duration, ) -> Result<Value, ResponseFailure>

Dispatch with the request’s configured bound on writer admission.

§Errors

Returns a dispatch refusal, invalid timeout, or busy naming an exhausted wait.

Source

pub fn dispatch_text_waiting( &self, operation: Operation, limit: NonZeroUsize, timeout: Duration, ) -> Result<Box<RawValue>, ResponseFailure>

Dispatch response text with the request’s writer admission bound.

§Errors

Returns a dispatch refusal, invalid timeout, or busy naming an exhausted wait.

Source

pub fn dispatch_text( &self, operation: Operation, response_byte_limit: NonZeroUsize, ) -> Result<Box<RawValue>, ResponseFailure>

The answer as the text the transport writes (NB1): a query.run or changes.list answer carries every stored body as the text it is stored as, never decoded and encoded again; any other answer is its value written once. Bounded as Self::dispatch_bounded.

§Errors

Returns a refusal with mutation context if dispatch fails or the text is over response_byte_limit.

Source

pub fn dispatch_bounded( &self, operation: Operation, response_byte_limit: NonZeroUsize, ) -> Result<Value, ResponseFailure>

Dispatch with a cumulative serialized-entry budget for collection and document pages, then verify the complete result against the same bound. The transport still owns the final envelope serialization and frame cap.

§Errors

Propagates any error from dispatch_with_entry_budget or fits_serialized.

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

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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