pub struct Datastore { /* private fields */ }

Implementations§

source§

impl Datastore

source

pub fn new() -> Self

source

pub fn advance_chain_tip(&mut self, count: u32) -> u32

source§

impl Datastore

source

pub fn open( path_str: &str, miner_tip: Option<&StacksBlockId> ) -> Result<Datastore>

source

pub fn as_analysis_db(&mut self) -> AnalysisDatabase<'_>

source

pub fn begin(&mut self, current: &StacksBlockId, next: &StacksBlockId)

begin, commit, rollback a save point identified by key this is used to clean up any data from aborted blocks (NOT aborted transactions that is handled by the clarity vm directly). The block header hash is used for identifying savepoints. this cannot be used to rollback to arbitrary prior block hash, because that blockhash would already have committed and no longer exist in the save point stack. this is a “lower-level” rollback than the roll backs performed in ClarityDatabase or AnalysisDatabase – this is done at the backing store level.

source

pub fn rollback(&mut self)

source

pub fn commit_mined_block(&mut self, will_move_to: &StacksBlockId)

source

pub fn commit_to(&mut self, final_bhh: &StacksBlockId)

source

pub fn get_chain_tip(&self) -> &StacksBlockId

source

pub fn set_chain_tip(&mut self, bhh: &StacksBlockId)

source

pub fn put(&mut self, key: &str, value: &str)

source

pub fn make_contract_hash_key(contract: &QualifiedContractIdentifier) -> String

Trait Implementations§

source§

impl ClarityBackingStore for Datastore

source§

fn get(&mut self, key: &str) -> Option<String>

fetch K-V out of the committed datastore

source§

fn set_block_hash(&mut self, bhh: StacksBlockId) -> Result<StacksBlockId>

change the current MARF context to service reads from a different chain_tip used to implement time-shifted evaluation. returns the previous block header hash on success

source§

fn get_current_block_height(&mut self) -> u32

this function returns the current block height, as viewed by this marfed-kv structure, i.e., it changes on time-shifted evaluation. the open_chain_tip functions always return data about the chain tip that is currently open for writing.

source§

fn make_contract_commitment( &mut self, contract_hash: Sha512Trunc256Sum ) -> String

The contract commitment is the hash of the contract, plus the block height in which the contract was initialized.

source§

fn put_all(&mut self, items: Vec<(String, String)>)

put K-V data into the committed datastore
source§

fn has_entry(&mut self, key: &str) -> bool

source§

fn get_block_at_height(&mut self, height: u32) -> Option<StacksBlockId>

Is None if block_height >= the “currently” under construction Stacks block height.
source§

fn get_open_chain_tip_height(&mut self) -> u32

source§

fn get_open_chain_tip(&mut self) -> StacksBlockId

source§

fn insert_metadata( &mut self, contract: &QualifiedContractIdentifier, key: &str, value: &str )

source§

fn get_metadata( &mut self, contract: &QualifiedContractIdentifier, key: &str ) -> Result<Option<String>>

source§

fn get_with_proof(&mut self, key: &str) -> Option<(String, Vec<u8>)>

fetch K-V out of the committed datastore, along with the byte representation of the Merkle proof for that key-value pair
source§

fn get_contract_hash( &mut self, _contract: &QualifiedContractIdentifier ) -> Result<(StacksBlockId, Sha512Trunc256Sum)>

This function is used to obtain a committed contract hash, and the block header hash of the block in which the contract was initialized. This data is used to store contract metadata in the side store.
source§

fn get_metadata_manual( &mut self, _at_height: u32, _contract: &QualifiedContractIdentifier, _key: &str ) -> Result<Option<String>>

source§

fn get_side_store(&mut self) -> &Connection

source§

fn get_cc_special_cases_handler( &self ) -> Option<&'static dyn Fn(&mut GlobalContext<'_, '_>, Option<&PrincipalData>, Option<&PrincipalData>, &QualifiedContractIdentifier, &str, &[Value], &Value) -> Result<(), Error>>

source§

fn put_all_metadata( &mut self, items: Vec<((QualifiedContractIdentifier, String), String)> )

source§

impl Clone for Datastore

source§

fn clone(&self) -> Datastore

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 Debug for Datastore

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Datastore

source§

fn default() -> Self

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

Auto Trait Implementations§

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
§

impl<T> Clear for Twhere T: InitializableFromZeroed + ?Sized,

§

fn clear(&mut self)

Completely overwrites this value.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InitializableFromZeroed for Twhere T: Default,

§

unsafe fn initialize(place: *mut T)

Called to initialize a place to a valid value, after it is set to all-bits-zero. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere 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 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more