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: SettingsThe named limits of changes.list.
embed_search_bound: Option<NonZeroU64>The most vectors one text search compares: query_scan_records.
Implementations§
Source§impl Service
impl Service
Sourcepub fn new(storage: Storage, max_page: NonZeroU32) -> Result<Self, Failure>
pub fn new(storage: Storage, max_page: NonZeroU32) -> Result<Self, Failure>
§Errors
Propagates any error from reader.
Sourcepub fn with_query(
storage: Storage,
max_page: NonZeroU32,
query: Option<Prepared>,
) -> Result<Self, Failure>
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.
Sourcepub fn with_lys(self, gate: Gate) -> Self
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.
Sourcepub fn with_placer(self, placer: Placer) -> Result<Self, Failure>
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.
Sourcepub fn present(&self, token: &str) -> Result<Value, Failure>
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.
Sourcepub fn run_drafts(
&self,
token: Option<&str>,
run: &DraftsRun,
) -> Result<Value, Failure>
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.
Sourcepub fn follow(
&self,
branch: &str,
expires: Option<u64>,
clock: impl Fn() -> SystemTime,
send: impl FnMut(&Value) -> Result<()>,
) -> Result<Failure>
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.
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.
Sourcepub fn start_release(&mut self, settings: Settings) -> Result<(), Failure>
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.
Sourcepub fn start_embedding(
&mut self,
worker: Arc<dyn Worker>,
bounds: Bounds,
writer_wait: Duration,
) -> Result<(), Failure>
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.
Sourcepub fn start_embedding_with(
&mut self,
worker: Arc<dyn Worker>,
bounds: Bounds,
writer_wait: Duration,
restart: Restart,
) -> Result<(), Failure>
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.
Sourcepub fn start_embedding_apart(
&mut self,
worker: Arc<dyn Worker>,
questions: Option<Arc<dyn Worker>>,
bounds: Bounds,
writer_wait: Duration,
restart: Restart,
) -> Result<(), Failure>
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.
Sourcepub fn dispatch(&self, operation: Operation) -> Result<Value, ResponseFailure>
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).
Sourcepub fn dispatch_waiting(
&self,
operation: Operation,
timeout: Duration,
) -> Result<Value, ResponseFailure>
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.
Sourcepub fn dispatch_text_waiting(
&self,
operation: Operation,
limit: NonZeroUsize,
timeout: Duration,
) -> Result<Box<RawValue>, ResponseFailure>
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.
Sourcepub fn dispatch_text(
&self,
operation: Operation,
response_byte_limit: NonZeroUsize,
) -> Result<Box<RawValue>, ResponseFailure>
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.
Sourcepub fn dispatch_bounded(
&self,
operation: Operation,
response_byte_limit: NonZeroUsize,
) -> Result<Value, ResponseFailure>
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.