Skip to main content

AccountIndexer

Struct AccountIndexer 

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

One account’s indexer: its own channel, its own worker, its own tables.

Implementations§

Source§

impl AccountIndexer

Source

pub fn start( account: &str, archive: Arc<File>, journal: Option<PathBuf>, ) -> Self

Start an indexer for account reading extents back out of archive. journal is the ack-path durable record a not-yet-indexed read falls back to scanning; None for a writer that keeps none.

Pack rows only. For the object rows as well, see start_with_absorber — a writer bench has no git store behind it and wants exactly this.

Source

pub fn start_with_absorber( account: &str, archive: Arc<File>, journal: Option<PathBuf>, absorber: Option<Arc<dyn ObjectAbsorb>>, ) -> Self

The same indexer with the object-level half wired in: each drained job’s objects are absorbed through absorber before the pack’s indexed bit goes up.

Source

pub fn account(&self) -> &str

The account this indexer belongs to.

Source

pub fn submit(&self, job: IndexJob) -> Result<()>

Hand an extent over. Returns immediately: 24 bytes onto a channel.

Source

pub fn cancel(&self)

Tell the worker to stop: every job still queued is dropped unabsorbed (its pack keeps a clear bit — nothing is declared indexed), and the absorber’s own cancel flag is what aborts the pack in flight.

Source

pub fn is_cancelled(&self) -> bool

Source

pub fn wait_caught_up(&self)

Block until this account’s index has caught up with everything submitted so far. Used by tests and by the bench’s “with index” column.

Source

pub fn is_indexed(&self, pack_id: u64) -> bool

Is this pack’s indexed bit set?

Source

pub fn rows(&self) -> usize

Number of index rows built so far.

Source

pub fn absorb_failures(&self) -> u64

How many packs failed ObjectAbsorb::absorb in this indexer. Their indexed bits are clear and their reads still fall back.

Source

pub fn last_absorb_error(&self) -> Option<String>

The most recent absorb error, if any.

Source

pub fn tables(&self) -> Vec<RecordBatch>

The built index tables.

Source

pub fn lookup(&self, pack_id: u64) -> Lookup

Answer a read, honestly, whether or not the index is ready.

Source

pub fn finish(self) -> Vec<RecordBatch>

Close the channel and join the worker, returning the final tables.

Trait Implementations§

Source§

impl Drop for AccountIndexer

Source§

fn drop(&mut self)

Cancel, then join — never join a worker that may be hours into a pack or parked by the memory watchdog. The queued jobs are dropped unabsorbed and the pack in flight is aborted at its next checkpoint; their bits stay clear, so the next open re-queues them from the journal (resumed 0%). Nobody waits on the indexer, and that includes the process shutting down and a repo delete.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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<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> 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