Skip to main content

Cache

Struct Cache 

Source
pub struct Cache {
    pub logs: Vec<(Buf, Vec<Int>)>,
    pub events: Vec<Trace>,
    pub sender: Option<Sender<Trace>>,
    pub filter: u32,
    pub fetched: Vec<Fetched>,
    pub index: usize,
    /* private fields */
}

Fields§

§logs: Vec<(Buf, Vec<Int>)>§events: Vec<Trace>§sender: Option<Sender<Trace>>§filter: u32§fetched: Vec<Fetched>§index: usize

Implementations§

Source§

impl Cache

Source

pub fn new() -> Self

Source

pub fn with_sender(sender: Sender<Trace>, filter: u32) -> Self

Source

pub fn insert_account(&mut self, addr: Acc, account: Account)

Source

pub fn account(&self, addr: &Acc) -> Option<&Account>

Source

pub fn storage(&self, addr: &Acc, key: &Int) -> Option<Int>

Source

pub fn reset(&mut self)

Source§

impl Cache

Source

pub fn snapshot(&self) -> Env

Trait Implementations§

Source§

impl Default for Cache

Source§

fn default() -> Cache

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

impl State for Cache

Source§

fn get(&mut self, acc: &Acc, key: &Int) -> Option<(Int, Int)>

Source§

fn put(&mut self, acc: &Acc, key: &Int, val: Int) -> Option<Int>

Source§

fn init(&mut self, acc: &Acc, key: &Int, val: Int)

Source§

fn tget(&mut self, acc: &Acc, key: &Int) -> Option<Int>

Source§

fn tput(&mut self, acc: Acc, key: Int, val: Int) -> Option<Int>

Source§

fn inc_nonce(&mut self, acc: &Acc, by: Int) -> Int

Source§

fn set_value(&mut self, acc: &Acc, value: Int) -> Int

Source§

fn set_code(&mut self, acc: &Acc, code: Buf, hash: Int) -> Int

Source§

fn set_auth(&mut self, src: &Acc, dst: &Acc)

Source§

fn merge(&mut self, acc: &Acc, chain: Account)

Source§

fn balance(&mut self, acc: &Acc) -> Option<Int>

Source§

fn nonce(&mut self, acc: &Acc) -> Option<Int>

Source§

fn code(&mut self, acc: &Acc) -> Option<(Buf, Int)>

Source§

fn acc(&mut self, acc: &Acc) -> Option<Account>

Source§

fn is_cold_acc(&self, acc: &Acc) -> bool

Source§

fn is_cold_key(&self, acc: &Acc, key: &Int) -> bool

Source§

fn warm_acc(&mut self, acc: &Acc) -> bool

Source§

fn warm_key(&mut self, acc: &Acc, key: &Int) -> bool

Source§

fn create(&mut self, acc: Acc, info: Account)

Source§

fn destroy(&mut self, acc: &Acc)

Source§

fn created(&self) -> Vec<Acc>

Source§

fn destroyed(&self) -> Vec<Acc>

Source§

fn head(&self, number: u64) -> Option<Head>

Source§

fn hash(&mut self, number: u64, hash: Int)

Source§

fn auth(&self, acc: &Acc) -> Option<Acc>

Source§

fn log(&mut self, data: Buf, topics: Vec<Int>)

Source§

fn get_depth(&mut self) -> usize

Source§

fn set_depth(&mut self, depth: usize)

Source§

fn emit(&mut self, event: Event) -> usize

Source§

fn save_fetched(&mut self, fetched: Fetched)

Source§

fn next_fetched(&mut self) -> Option<Fetched>

Source§

fn prefetched(&mut self, fetched: Vec<Fetched>)

Source§

fn is_offline(&self) -> bool

Source§

fn checkpoint(&mut self) -> usize

Take a state checkpoint; returns an opaque ID that can be passed to revert_to.
Source§

fn revert_to(&mut self, cp: usize)

Revert all state mutations since the given checkpoint.
Source§

fn apply(&mut self)

Source§

fn set_chain_id(&mut self, id: u64)

Source§

fn get_chain_id(&self) -> u64

Source§

fn is_tracing(&self) -> bool

Source§

fn reset(&mut self)

Auto Trait Implementations§

§

impl !RefUnwindSafe for Cache

§

impl !UnwindSafe for Cache

§

impl Freeze for Cache

§

impl Send for Cache

§

impl Sync for Cache

§

impl Unpin for Cache

§

impl UnsafeUnpin for Cache

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
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