Trait essential_storage::Storage

source ·
pub trait Storage: StateStorage {
Show 15 methods // Required methods fn insert_contract( &self, predicate: SignedContract, ) -> impl Future<Output = Result<()>> + Send; fn insert_solution_into_pool( &self, solution: Solution, ) -> impl Future<Output = Result<()>> + Send; fn move_solutions_to_solved( &self, solutions: &[Hash], ) -> impl Future<Output = Result<()>> + Send; fn move_solutions_to_failed( &self, solutions: &[(Hash, SolutionFailReason)], ) -> impl Future<Output = Result<()>> + Send; fn get_predicate( &self, address: &PredicateAddress, ) -> impl Future<Output = Result<Option<Predicate>>> + Send; fn get_contract( &self, address: &ContentAddress, ) -> impl Future<Output = Result<Option<SignedContract>>> + Send; fn list_contracts( &self, time_range: Option<Range<Duration>>, page: Option<usize>, ) -> impl Future<Output = Result<Vec<Contract>>> + Send; fn subscribe_contracts( self, start_time: Option<Duration>, start_page: Option<usize>, ) -> impl Stream<Item = Result<Contract>> + Send + 'static; fn list_solutions_pool( &self, page: Option<usize>, ) -> impl Future<Output = Result<Vec<Solution>>> + Send; fn list_failed_solutions_pool( &self, page: Option<usize>, ) -> impl Future<Output = Result<Vec<FailedSolution>>> + Send; fn list_blocks( &self, time_range: Option<Range<Duration>>, block_number: Option<u64>, page: Option<usize>, ) -> impl Future<Output = Result<Vec<Block>>> + Send; fn subscribe_blocks( self, start_time: Option<Duration>, block_number: Option<u64>, start_page: Option<usize>, ) -> impl Stream<Item = Result<Block>> + Send + 'static; fn get_solution( &self, solution_hash: Hash, ) -> impl Future<Output = Result<Option<SolutionOutcomes>>> + Send; fn prune_failed_solutions( &self, older_than: Duration, ) -> impl Future<Output = Result<()>> + Send; fn commit_block( &self, data: CommitData<'_>, ) -> impl Future<Output = Result<()>> + Send;
}
Expand description

Storage trait for the Essential platform. All inserts and updates are idempotent.

Required Methods§

source

fn insert_contract( &self, predicate: SignedContract, ) -> impl Future<Output = Result<()>> + Send

Insert a contract with their storage layout.

source

fn insert_solution_into_pool( &self, solution: Solution, ) -> impl Future<Output = Result<()>> + Send

Add a solution to the pool of unsolved solutions.

source

fn move_solutions_to_solved( &self, solutions: &[Hash], ) -> impl Future<Output = Result<()>> + Send

Move these solutions from the pool to the solved state.

source

fn move_solutions_to_failed( &self, solutions: &[(Hash, SolutionFailReason)], ) -> impl Future<Output = Result<()>> + Send

Move these solutions from the pool to the failed state.

source

fn get_predicate( &self, address: &PredicateAddress, ) -> impl Future<Output = Result<Option<Predicate>>> + Send

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

source

fn get_contract( &self, address: &ContentAddress, ) -> impl Future<Output = Result<Option<SignedContract>>> + Send

Get the entire contract.

source

fn list_contracts( &self, time_range: Option<Range<Duration>>, page: Option<usize>, ) -> impl Future<Output = Result<Vec<Contract>>> + Send

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

fn list_solutions_pool( &self, page: Option<usize>, ) -> impl Future<Output = Result<Vec<Solution>>> + Send

List all solutions in the pool.

source

fn list_failed_solutions_pool( &self, page: Option<usize>, ) -> impl Future<Output = Result<Vec<FailedSolution>>> + Send

List all failed solutions in the pool.

source

fn list_blocks( &self, time_range: Option<Range<Duration>>, block_number: Option<u64>, page: Option<usize>, ) -> impl Future<Output = Result<Vec<Block>>> + Send

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

fn get_solution( &self, solution_hash: Hash, ) -> impl Future<Output = Result<Option<SolutionOutcomes>>> + Send

Get failed solution and its failing reason.

source

fn prune_failed_solutions( &self, older_than: Duration, ) -> impl Future<Output = Result<()>> + Send

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.

Object Safety§

This trait is not object safe.

Implementors§