pub struct Cold { /* private fields */ }Expand description
Cold segments of a directory, with a budget for open ones.
Implementations§
Source§impl Cold
impl Cold
pub fn open(dir: &Path) -> Result<Cold, String>
Sourcepub fn open_with(dir: &Path, prev: &Cold) -> Result<Cold, String>
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.
pub fn segments(&self) -> &[Arc<ColdSegment>]
pub fn first(&self) -> Option<u32>
pub fn last(&self) -> Option<u32>
pub fn contains(&self, seq: u32) -> bool
Sourcepub fn with_open_limit(self, n: usize) -> Cold
pub fn with_open_limit(self, n: usize) -> Cold
Same segments with a different open limit (tests use a small one).
Sourcepub fn with_cache_budget(self, bytes: usize) -> Cold
pub fn with_cache_budget(self, bytes: usize) -> Cold
Same segments with a different budget for the whole block cache.
Sourcepub fn ledger(
&self,
seq: u32,
with_changes: bool,
) -> Result<Option<Ledger>, String>
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.
Sourcepub fn patches(&self, seq: u32) -> Result<Option<LedgerPatches>, String>
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).
Sourcepub fn header(&self, seq: u32) -> Result<Option<Vec<u8>>, String>
pub fn header(&self, seq: u32) -> Result<Option<Vec<u8>>, String>
Header of a cold ledger alone; None if it is not here.
Sourcepub fn ledgers(&self, seqs: &[u32]) -> Result<HashMap<u32, Ledger>, String>
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.
Sourcepub fn transactions(
&self,
wants: &[(u32, u32)],
) -> Result<HashMap<u32, Ledger>, String>
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.
Sourcepub fn open_count(&self) -> usize
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].