Skip to main content

Reader

Struct Reader 

Source
pub struct Reader<S: TileStore> { /* private fields */ }
Expand description

Reads a log at one tree state. Every entry it returns hashes to the leaf the checked tiles hold for its index.

Implementations§

Source§

impl<S: TileStore> Reader<S>

Source

pub fn open(store: S, keys: KeyFn) -> Result<Self>

A reader at the tree state the store holds, with the log’s key function; the empty tree for a store without a state.

Source

pub fn at(store: S, size: u64, root: Hash, keys: KeyFn) -> Result<Self>

A reader that trusts root to be the root at size, which is how a verified checkpoint opens a log.

Source

pub fn open_checkpoint( store: S, origin: &str, trusted: &[Verifier], keys: KeyFn, ) -> Result<Self>

A reader at the store’s published checkpoint, once a key in trusted has signed it; the checkpoint’s origin has to be origin. This is how a reader that does not trust the writer’s tree state opens a log.

Source

pub fn manifest(&self) -> &Manifest

The manifest rows for the sealed bundles the root covers.

Source

pub fn find(&self, key: &[u8]) -> Result<Vec<u64>>

Indices of every entry carrying key, ascending: through the manifest ranges, the filters and the sidecars for sealed bundles, then a scan of the unsealed one. A key is an identity hash or a value the key function derives; each hit is checked on the entry itself.

Source

pub fn store(&self) -> &S

The store behind the reader.

Source

pub fn size(&self) -> u64

Entries the reader’s root covers.

Source

pub fn root(&self) -> Hash

The trusted root.

Source

pub fn hashes(&self) -> &TileHashReader<S>

The checked tile reader.

Source

pub fn get(&self, index: u64) -> Result<Option<Vec<u8>>>

Entry index, checked against its leaf hash; nothing past the size.

Source

pub fn inclusion(&self, index: u64) -> Result<Option<Vec<Hash>>>

The inclusion proof for entry index, from checked tiles; the bytes rfc9162::inclusion_proof gives over the flat leaf slice.

Source

pub fn consistency(&self, old: u64) -> Result<Option<Vec<Hash>>>

The consistency proof from a tree of old entries to this one, from checked tiles; the bytes rfc9162::consistency_proof gives.

Source

pub fn bundle(&self, index: u64) -> Result<Vec<Vec<u8>>>

Every entry of bundle index, each checked against its leaf hash.

Auto Trait Implementations§

§

impl<S> !Freeze for Reader<S>

§

impl<S> !RefUnwindSafe for Reader<S>

§

impl<S> !Send for Reader<S>

§

impl<S> !Sync for Reader<S>

§

impl<S> Unpin for Reader<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Reader<S>
where S: UnsafeUnpin,

§

impl<S> !UnwindSafe for Reader<S>

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