Skip to main content

CodexAnchorScanner

Struct CodexAnchorScanner 

Source
pub struct CodexAnchorScanner { /* private fields */ }
Expand description

What a client has already taken from each rollout it watches.

This is the shared half of the anchor lane’s state: which anchors are still owed, and whether a rollout is worth re-reading. Both answers are statements about Codex’s file format — rollouts are append-only, so a stable size+mtime fingerprint means no new anchors, and each anchor’s identity is its SubAgentAnchor::dedup_key — and a client that re-derived them would be re-deriving how much of a session’s causal skeleton gets uploaded.

Everything around it stays with the client: the tick, the HTTP call, the credential, the failure backoff, and the scope rule that decides which rollouts are handed here at all.

A scanner is only ever as large as the live rollout set — call Self::retain_live each tick with the current snapshot.

Implementations§

Source§

impl CodexAnchorScanner

Source

pub fn new() -> Self

An empty scanner.

Source

pub fn retain_live<'a, I>(&mut self, live: I)
where I: IntoIterator<Item = &'a Path>,

Drop bookkeeping for every rollout not in live.

Codex’s rollout directory is retention-bounded and a watcher snapshot only reports recent files, so without this the map grows for the life of a long-running client.

Source

pub fn needs_read( &self, rollout: &Path, fingerprint: Option<FileFingerprint>, ) -> bool

Whether rollout is worth reading, given its current fingerprint.

false when the file could not be fingerprinted (vanished, or stat failed — skip this tick) or when it has not moved since the last clean scan. Rollouts are append-only, so an unchanged fingerprint cannot hide a new anchor.

Source

pub fn undelivered(&self, rollout: &Path, raw: &[u8]) -> Vec<SubAgentAnchor>

The anchors in raw that have not been reported delivered for rollout, in file order.

Source

pub fn record_delivered(&mut self, rollout: &Path, anchor: &SubAgentAnchor)

Record that the server accepted anchor’s row (including a dedup — the bytes are stored either way).

Source

pub fn record_clean_scan( &mut self, rollout: &Path, fingerprint: Option<FileFingerprint>, )

Record a scan that left nothing owed, so rollout is not re-read until it grows.

A client must NOT call this after a partial failure: leaving the fingerprint behind is what makes the next tick re-read and retry.

Source

pub fn delivered_count(&self, rollout: &Path) -> usize

How many anchors have been reported delivered for rollout.

Trait Implementations§

Source§

impl Debug for CodexAnchorScanner

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodexAnchorScanner

Source§

fn default() -> CodexAnchorScanner

Returns the “default value” for a type. Read more

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