Skip to main content

CachedStore

Struct CachedStore 

Source
pub struct CachedStore { /* private fields */ }

Implementations§

Source§

impl CachedStore

Source

pub fn new(db: Arc<Db>, capacity: usize) -> Self

db を包み、読んだ状態を capacity バイトまで覚える

Source

pub fn db(&self) -> &Db

Source

pub fn shared_db(&self) -> Arc<Db> ⓘ

ほかのスレッドに渡す、同じ DB

Trait Implementations§

Source§

impl ChainStore for CachedStore

Source§

async fn load_state( &self, ) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>

実行の状態(木に入らないもの)、状態の行、木のノード。始めるときと、巻き戻しに失敗して読み直すときに使う
Source§

async fn load_partial_state( &self, ) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>

ChainStore::load_state の、アカウントの行を除いたもの。アカウントを全部はメモリに持たないときに使う
Source§

async fn block(&self, height: u64) -> Result<Option<Vec<u8>>, ChainError>

Source§

async fn blocks_from(&self) -> Result<u64, ChainError>

残っている一番低いブロックの高さ(刈り込んでいなければ 0)
Source§

async fn proof(&self, epoch: u32) -> Result<Option<Vec<u8>>, ChainError>

Source§

async fn proofs_tip(&self) -> Result<u32, ChainError>

しまった一番新しい証明のエポック(なければ 0)
Source§

async fn voters(&self, epoch: u32) -> Result<Option<Vec<u8>>, ChainError>

Source§

async fn put_proof(&self, epoch: u32, proof: &[u8]) -> Result<(), ChainError>

Source§

async fn commit_block(&self, write: BlockWrite<'_>) -> Result<(), ChainError>

ブロック1つ分を書いてコミットする。孤立ブロックの表にあれば外す
Source§

async fn prune(&self, prune: Prune) -> Result<Pruned, ChainError>

Source§

async fn checkpoint_at_or_below( &self, height: u64, ) -> Result<Option<(u64, Vec<u8>)>, ChainError>

height 以下で一番新しいチェックポイント(高さ、実行の状態)
Source§

async fn changes_above(&self, height: u64) -> Result<Vec<Change>, ChainError>

height より上で変わった状態の行の、height のときの値
Source§

async fn rollback( &self, height: u64, voters_from: u32, orphans: &[(u64, [u8; 32], &[u8])], ) -> Result<(), ChainError>

height より上を消して height に戻す。投票者は voters_from から消し、外れた枝のブロックは孤立ブロックの 表にしまう
Source§

impl StateSource for CachedStore

Source§

fn row(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>

状態の行 key(super::persist::row_key)。なければ None
Source§

fn node(&self, key: &[u8]) -> Result<Option<Vec<u8>>, ExecError>

木のノード key(crate::tree::node_key)。なければ None
Source§

fn for_each_row( &self, prefix: &[u8], visit: &mut dyn FnMut(&[u8], &[u8]), ) -> Result<(), ExecError>

キーが prefix で始まる状態の行を、キーの順に visit に渡す。全部を一度にメモリに置かない

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.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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