pub struct OpenedIndex { /* private fields */ }Expand description
A long-lived, synchronously controlled filesystem index.
Clones are cheap references to one authority. Calling Self::close through any
clone cancels and joins every worker owned by that authority, and every concurrent
caller receives the same stored terminal outcome.
Implementations§
Source§impl OpenedIndex
impl OpenedIndex
Sourcepub fn basis() -> Basis
pub fn basis() -> Basis
The basis every opened root holds, stated once for every route into one.
No analyzers, because an opened root runs none, and control state always observed,
because its ignored and unignored partitions are part of what it serves –
OpenOptions has no switch for either, and reads this rather than restating it.
The root is empty because no rule in the request model compares roots and an opened
read names none: it asks the root it already holds.
Stated rather than read back from the retained index, so a read is refused before any stored state is touched, which is where every other surface refuses one.
Sourcepub fn open(plan: &Plan, options: OpenOptions) -> Result<Self>
pub fn open(plan: &Plan, options: OpenOptions) -> Result<Self>
Open one live root without changing the existing blocking crate::open API.
This constructor validates and binds the root and semantic configuration, starts cold progressive discovery, and captures optional observation before that baseline begins. No cache image or second mutable index is created here.
Sourcepub fn close(&self) -> Result<()>
pub fn close(&self) -> Result<()>
Cancel and join all work owned by this opened root.
The first caller performs shutdown. Concurrent and repeated callers wait for or replay its stored terminal outcome; success is never reported while a worker is still live.
Sourcepub fn prioritize(&self, paths: &[PathBuf]) -> Result<()>
pub fn prioritize(&self, paths: &[PathBuf]) -> Result<()>
Reorder pending discovery toward the supplied relative paths.
This is a bounded best-effort scheduling hint. It does not change scope, facts, lifecycle state, or the index clock, and paths that are already complete simply have no effect.
Sourcepub fn read(&self, request: ReadRequest) -> Result<ReadResponse>
pub fn read(&self, request: ReadRequest) -> Result<ReadResponse>
Return requested projections from one committed version and state boundary.
§Errors
The whole read fails only when no projection in it can be trusted: the request’s
shape is invalid (a bound out of range, too many projections, a path that escapes the
root, a continuation another root issued or this one never did), the root is closed,
or crate::ReadRequest::expected or a continuation pins a version the index no
longer holds. What one projection finds at the pinned version – including a
continuation this root issued and has since consumed or evicted – is that
projection’s crate::ProjectionRefusal instead, returned in its position while
every other projection answers.
The lifecycle lock guards only the phase check. The projection’s coherence comes from the index read boundary, which any number of readers share, so holding the lifecycle lock across it would serialize every read with every other read and with refresh, worker registration, and the start of close. A read that races close cannot leave state behind: the continuation table refuses records once shutdown clears it.
Sourcepub fn changes(&self, request: ChangeRequest) -> Result<ChangePoll>
pub fn changes(&self, request: ChangeRequest) -> Result<ChangePoll>
Return exact commits after one version, waiting up to the supplied timeout.
A poll waiting on an idle journal returns as soon as an owned worker panics, with
Error::OpenedWorkerPanicked naming the worker – the cause Self::close will
report – rather than at its timeout. Commits retained before the panic are still
returned first, unless the panic struck inside a commit: that poisons the index,
which leaves nothing to read. A poll parked on the journal then reports the panic.
A poll already reading when the commit panics can observe the poisoned index before
the worker has recorded its panic, and returns Error::IndexLockPoisoned; the
panic is recorded moments later, and Self::close names it either way.
Sourcepub fn refresh(&self, paths: &[PathBuf]) -> Result<RefreshResult>
pub fn refresh(&self, paths: &[PathBuf]) -> Result<RefreshResult>
Verify a bounded set of relative paths and conditionally commit exact changes.
Inputs are classified as one set: duplicates are removed, descendants covered
by an accepted ancestor cost no second walk, and an empty set is a no-op. The
returned (after, version] interval is safe as the next journal boundary even
when another producer committed concurrently.