Struct 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

Source§

type Error = MemoryStorageError

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

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

The future type returned from the key_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, block_number: u64, block_timestamp: Duration, 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§

fn subscribe_contracts( self, start_time: Option<Duration>, start_page: Option<usize>, ) -> impl Stream<Item = Result<Contract>> + Send + 'static

Subscribe to new contracts from a given start page or start time. This will return all the contracts from that point then continue to stream as new contracts are added.
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_blocks( &self, time_range: Option<Range<Duration>>, block_number: Option<u64>, page: Option<usize>, ) -> Result<Vec<Block>>

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

fn subscribe_blocks( self, start_time: Option<Duration>, block_number: Option<u64>, start_page: Option<usize>, ) -> impl Stream<Item = Result<Block>> + Send + 'static

Subscribe to new blocks from a given block number or start page or start time. This will return all the blocks from that point then continue to stream as new blocks are added.
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.
Source§

async fn get_latest_block(&self) -> Result<Option<Block>>

Get latest block.

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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.