Struct essential_memory_storage::MemoryStorage

source ·
pub struct MemoryStorage { /* private fields */ }

Implementations§

source§

impl MemoryStorage

source

pub fn new() -> Self

Trait Implementations§

source§

impl Clone for MemoryStorage

source§

fn clone(&self) -> MemoryStorage

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for MemoryStorage

source§

fn default() -> Self

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

impl QueryState for MemoryStorage

source§

async fn query_state( &self, address: &ContentAddress, key: &Key, ) -> Result<Vec<Word>>

Query the state of a content address.
source§

impl StateRead for MemoryStorage

§

type Error = MemoryStorageError

An error type describing any cases that might occur during state reading.
§

type Future = Pin<Box<dyn Future<Output = Result<Vec<Vec<i64>>, <MemoryStorage as StateRead>::Error>> + Send>>

The future type returned from the word_range method. Read more
source§

fn key_range( &self, contract_addr: ContentAddress, key: Key, num_words: usize, ) -> Self::Future

Read the given number of values from state at the given key associated with the given contract address.
source§

impl StateStorage for MemoryStorage

source§

async fn update_state( &self, address: &ContentAddress, key: &Key, value: Vec<Word>, ) -> Result<Vec<Word>>

Update the state of a content address.
source§

async fn update_state_batch<U>(&self, updates: U) -> Result<Vec<Vec<Word>>>
where U: IntoIterator<Item = (ContentAddress, Key, Vec<Word>)> + Send,

Update a batch of state in one transaction.
source§

impl Storage for MemoryStorage

source§

async fn insert_contract(&self, signed: SignedContract) -> Result<()>

Insert a contract with their storage layout.
source§

async fn insert_solution_into_pool(&self, solution: Solution) -> Result<()>

Add a solution to the pool of unsolved solutions.
source§

async fn move_solutions_to_solved(&self, solutions: &[Hash]) -> Result<()>

Move these solutions from the pool to the solved state.
source§

async fn move_solutions_to_failed( &self, solutions: &[(Hash, SolutionFailReason)], ) -> Result<()>

Move these solutions from the pool to the failed state.
source§

async fn get_predicate( &self, address: &PredicateAddress, ) -> Result<Option<Predicate>>

Get an individual predicate. Note that the same predicate might be in multiple contracts.
source§

async fn get_contract( &self, address: &ContentAddress, ) -> Result<Option<SignedContract>>

Get the entire contract.
source§

async fn list_contracts( &self, time_range: Option<Range<Duration>>, page: Option<usize>, ) -> Result<Vec<Contract>>

List all contracts. This will paginate the results. The page is 0-indexed. A time range can optionally be provided to filter the results. The time is duration since the Unix epoch.
source§

async fn list_solutions_pool( &self, page: Option<usize>, ) -> Result<Vec<Solution>>

List all solutions in the pool.
source§

async fn list_failed_solutions_pool( &self, page: Option<usize>, ) -> Result<Vec<FailedSolution>>

List all failed solutions in the pool.
source§

async fn list_winning_blocks( &self, time_range: Option<Range<Duration>>, page: Option<usize>, ) -> Result<Vec<Block>>

List all blocks of solutions that have been solved.
source§

async fn get_solution( &self, solution_hash: Hash, ) -> Result<Option<SolutionOutcomes>>

Get failed solution and its failing reason.
source§

async fn prune_failed_solutions(&self, older_than: Duration) -> Result<()>

Prune failed solutions that failed before the provided duration.
source§

fn commit_block( &self, data: CommitData<'_>, ) -> impl Future<Output = Result<()>> + Send

Commit block data atomically.

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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
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 for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.