Struct era_test_node::deps::storage_view::StorageView
source · pub struct StorageView<S> {
pub storage_handle: S,
pub modified_storage_keys: HashMap<StorageKey, StorageValue>,
/* private fields */
}
Expand description
StorageView
is a buffer for StorageLog
s between storage and transaction execution code.
In order to commit transactions logs should be submitted to the underlying storage
after a transaction is executed.
When executing transactions as a part of miniblock / L1 batch creation,
a single StorageView
is used for the entire L1 batch.
One StorageView
must not be used for multiple L1 batches;
otherwise, Self::is_write_initial()
will return incorrect values because of the caching.
When executing transactions in the API sandbox, a dedicated view is used for each transaction; the only shared part is the read storage keys cache.
Fields§
§storage_handle: S
§modified_storage_keys: HashMap<StorageKey, StorageValue>
Implementations§
source§impl<S: ReadStorage + Debug> StorageView<S>
impl<S: ReadStorage + Debug> StorageView<S>
sourcepub fn new(storage_handle: S) -> Self
pub fn new(storage_handle: S) -> Self
Creates a new storage view based on the underlying storage.
pub fn clean_cache(&mut self)
sourcepub fn into_rc_ptr(self) -> Rc<RefCell<Self>>
pub fn into_rc_ptr(self) -> Rc<RefCell<Self>>
Make a Rc RefCell ptr to the storage
Trait Implementations§
source§impl<S: Debug> Debug for StorageView<S>
impl<S: Debug> Debug for StorageView<S>
source§impl<S: ReadStorage + Debug> ReadStorage for StorageView<S>
impl<S: ReadStorage + Debug> ReadStorage for StorageView<S>
source§fn is_write_initial(&mut self, key: &StorageKey) -> bool
fn is_write_initial(&mut self, key: &StorageKey) -> bool
Only keys contained in the underlying storage will return false
. If a key was
inserted using Self::set_value()
, it will still return true
.
source§fn read_value(&mut self, key: &StorageKey) -> StorageValue
fn read_value(&mut self, key: &StorageKey) -> StorageValue
source§fn load_factory_dep(&mut self, hash: H256) -> Option<Vec<u8>>
fn load_factory_dep(&mut self, hash: H256) -> Option<Vec<u8>>
source§fn get_enumeration_index(&mut self, key: &StorageKey) -> Option<u64>
fn get_enumeration_index(&mut self, key: &StorageKey) -> Option<u64>
key
.§fn is_bytecode_known(&mut self, bytecode_hash: &H256) -> bool
fn is_bytecode_known(&mut self, bytecode_hash: &H256) -> bool
source§impl<S: ReadStorage + Debug> WriteStorage for StorageView<S>
impl<S: ReadStorage + Debug> WriteStorage for StorageView<S>
source§fn set_value(&mut self, key: StorageKey, value: StorageValue) -> StorageValue
fn set_value(&mut self, key: StorageKey, value: StorageValue) -> StorageValue
source§fn read_storage_keys(&self) -> &HashMap<StorageKey, StorageValue>
fn read_storage_keys(&self) -> &HashMap<StorageKey, StorageValue>
source§fn modified_storage_keys(&self) -> &HashMap<StorageKey, StorageValue>
fn modified_storage_keys(&self) -> &HashMap<StorageKey, StorageValue>
source§fn missed_storage_invocations(&self) -> usize
fn missed_storage_invocations(&self) -> usize
Auto Trait Implementations§
impl<S> RefUnwindSafe for StorageView<S>where
S: RefUnwindSafe,
impl<S> Send for StorageView<S>where
S: Send,
impl<S> Sync for StorageView<S>where
S: Sync,
impl<S> Unpin for StorageView<S>where
S: Unpin,
impl<S> UnwindSafe for StorageView<S>where
S: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request