pub struct KvChainStore<'a> { /* private fields */ }

Implementations§

source§

impl<'a> KvChainStore<'a>

source

pub fn new(datadir: String) -> Result<KvChainStore<'a>, Error>

Trait Implementations§

source§

impl<'a> ChainStore for KvChainStore<'a>

§

type Error = Error

source§

fn load_roots(&self) -> Result<Option<Vec<u8>>, Self::Error>

Loads the state of our accumulator.
source§

fn save_roots(&self, roots: Vec<u8>) -> Result<(), Self::Error>

Saves the current state of our accumulator.
source§

fn load_height(&self) -> Result<Option<BestChain>, Self::Error>

Loads the blockchain height
source§

fn save_height(&self, height: &BestChain) -> Result<(), Self::Error>

Saves the blockchain height.
source§

fn get_header( &self, block_hash: &BlockHash ) -> Result<Option<DiskBlockHeader>, Self::Error>

Get a block header from our database. See DiskBlockHeader for more info about the data we save.
source§

fn flush(&self) -> Result<(), Self::Error>

Flushes write buffers to disk, this is called periodically by the [ChainState], so in case of a crash, we don’t lose too much data. If the database doesn’t support write buffers, this method can be a no-op.
source§

fn save_header(&self, header: &DiskBlockHeader) -> Result<(), Self::Error>

Saves a block header to our database. See DiskBlockHeader for more info about the data we save.
source§

fn get_block_hash(&self, height: u32) -> Result<Option<BlockHash>, Self::Error>

Returns the block hash for a given height.
source§

fn update_block_index( &self, height: u32, hash: BlockHash ) -> Result<(), Self::Error>

Associates a block hash with a given height, so we can retrieve it later.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for KvChainStore<'a>

§

impl<'a> Send for KvChainStore<'a>

§

impl<'a> Sync for KvChainStore<'a>

§

impl<'a> Unpin for KvChainStore<'a>

§

impl<'a> !UnwindSafe for KvChainStore<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

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

Initializes a with the given initializer. Read more
source§

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

Dereferences the given pointer. Read more
source§

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

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.