pub struct SequencerHandle { /* private fields */ }Expand description
Cloneable client handle; one per workspace/agent.
Implementations§
Source§impl SequencerHandle
impl SequencerHandle
Sourcepub fn durability_failed(&self) -> bool
pub fn durability_failed(&self) -> bool
Whether a durability barrier has failed, after which this writer refuses every submission.
Exposed rather than acted on. The sequencer’s job is to say that it can no longer promise durability; deciding what a node does about that — keep serving reads, exit so supervision restarts it, page someone — is a lifecycle policy, and a library linked by every embedder including the test suite is the wrong place to make it.
The daemon polls this and exits, so launchd’s KeepAlive restarts
into the same replay path a kill -9 already exercises. Without an
observer, fail-closed is invisible to supervision: the process
stays up refusing everything, and a transient fsync error becomes
permanent downtime that looks like uptime.
Sourcepub fn submit(&self, channel: &str, payload: Vec<u8>) -> Accepted
pub fn submit(&self, channel: &str, payload: Vec<u8>) -> Accepted
Blocks until the sequencer has durably ordered the op. Unsigned
convenience wrapper over SequencerHandle::try_submit; only
valid under a policy that admits unsigned ops.
§Panics
Panics if the sequencer thread has shut down or the policy rejects the op.
Sourcepub fn try_submit(
&self,
channel: &str,
payload: Vec<u8>,
author_sig: Option<Witness>,
) -> Result<Accepted, String>
pub fn try_submit( &self, channel: &str, payload: Vec<u8>, author_sig: Option<Witness>, ) -> Result<Accepted, String>
Blocks until the sequencer has ordered the op or rejected it.
§Errors
The policy’s rejection reason, or a fairness rejection naming
the quota when this actor already has too many ops awaiting a
decision. The quota is checked here, on the calling thread, before
anything is sent: an over-quota submitter is answered, never
parked, so a client always has something to react to.
§Panics
Panics if the sequencer thread has already shut down.
Sourcepub fn replicate(
&self,
entries: Vec<Sequenced>,
) -> Result<Replicated, ReplicateError>
pub fn replicate( &self, entries: Vec<Sequenced>, ) -> Result<Replicated, ReplicateError>
Appends entries another writer already sequenced, in order, through this writer thread, and folds each one.
This is how a replica takes a log without becoming a second writer
(invariant 5): the entries keep the seq and parent their own
writer gave them, and this thread is still the only thing that
appends. Each must continue this log exactly (next position, this
head as parent, content hashing to the claimed hash) and the
policy’s SubmitPolicy::replicable must say it can fold it.
SubmitPolicy::check is never run: admission was the source
writer’s decision.
The whole batch shares one durability barrier and is answered after it. Replicated entries are not admission decisions, so they are not journalled, counted against a quota, or measured by the lag meter.
§Errors
The first entry that failed, with how many before it were appended. Nothing after it is attempted.
§Panics
Panics if the sequencer thread has already shut down.
Sourcepub fn try_submit_many(
&self,
subs: Vec<Submission>,
) -> Vec<Result<Accepted, String>>
pub fn try_submit_many( &self, subs: Vec<Submission>, ) -> Vec<Result<Accepted, String>>
Offers every submission before waiting for any reply, so the whole group is already queued when the writer next drains — and therefore shares one durability barrier instead of one each.
This is the difference between an N-op request costing N fsyncs and
costing ceil(N / MAX_BATCH). Calling SequencerHandle::try_submit
in a loop cannot achieve it: each call blocks until its own reply,
so the queue is empty every time the writer looks and every op
becomes its own batch.
Results are returned in submission order, one per input. Each is
independent: a rejection does not abort the rest, matching the
per-op semantics /api/submit-batch already promised.
§Panics
Panics if the sequencer thread has already shut down.
Trait Implementations§
Source§impl Clone for SequencerHandle
impl Clone for SequencerHandle
Source§fn clone(&self) -> SequencerHandle
fn clone(&self) -> SequencerHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more