Skip to main content

Cold

Struct Cold 

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

Cold segments of a directory, with a budget for open ones.

Implementations§

Source§

impl Cold

Source

pub fn open(dir: &Path) -> Result<Cold, String>

Source

pub fn open_with(dir: &Path, prev: &Cold) -> Result<Cold, String>

Like open, but segments from prev carry over as is, with their open files, block cache and place in the open budget.

Source

pub fn segments(&self) -> &[Arc<ColdSegment>]

Source

pub fn first(&self) -> Option<u32>

Source

pub fn last(&self) -> Option<u32>

Source

pub fn contains(&self, seq: u32) -> bool

Source

pub fn with_open_limit(self, n: usize) -> Cold

Same segments with a different open limit (tests use a small one).

Source

pub fn with_cache_budget(self, bytes: usize) -> Cold

Same segments with a different budget for the whole block cache.

Source

pub fn ledger( &self, seq: u32, with_changes: bool, ) -> Result<Option<Ledger>, String>

A ledger from the cold history; None if it is not here. Without changes only the header and transactions are decoded.

Source

pub fn patches(&self, seq: u32) -> Result<Option<LedgerPatches>, String>

Header and state patches of a cold ledger, without transactions or change kinds; None if it is not here. A patch with empty data deletes the object. A source without kinds has these too, but nothing has checked them against AccountHash: that is for the caller (coldreplay).

Source

pub fn header(&self, seq: u32) -> Result<Option<Vec<u8>>, String>

Header of a cold ledger alone; None if it is not here.

Source

pub fn ledgers(&self, seqs: &[u32]) -> Result<HashMap<u32, Ledger>, String>

Several ledgers without changes; those not in cold history are left out. Ledgers of one block go to one reader, so the block is prepared once, and different blocks are read on up to COLD_READERS threads.

Source

pub fn transactions( &self, wants: &[(u32, u32)], ) -> Result<HashMap<u32, Ledger>, String>

Ledgers holding only the transactions asked for, by ledger and TransactionIndex, and their headers; an index the ledger doesn’t have is left out. In a JC06 block only the part holding a ledger is decoded.

Source

pub fn open_count(&self) -> usize

How many segments are open right now. Counted under the same lock that guards closing and opening segments; otherwise the count could see a closing segment and a freshly opened one at the same time.

Trait Implementations§

Source§

impl Debug for Cold

Source§

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

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

impl Default for Cold

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Cold

§

impl RefUnwindSafe for Cold

§

impl Send for Cold

§

impl Sync for Cold

§

impl Unpin for Cold

§

impl UnsafeUnpin for Cold

§

impl UnwindSafe for Cold

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more