pub struct InMemoryStorage { /* private fields */ }
Expand description

InMemoryStorage represents a key value store that is purely in memory and intended for single threads (or must be wrapped by a Arc<RwLock<>>). This provides no permission checks and simply is a proof of concept to unblock building of applications without more complex data stores. Internally, it retains all data, which means that it must make copies of all key material which violates the Diem code base. It violates it because the anticipation is that data stores would securely handle key material. This should not be used in production.

Implementations§

source§

impl InMemoryStorage

source

pub fn new() -> Self

source§

impl InMemoryStorage

source

pub fn new_with_time_service(time_service: TimeService) -> Self

Trait Implementations§

source§

impl Default for InMemoryStorage

source§

fn default() -> InMemoryStorage

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

impl From<InMemoryStorage> for Storage

source§

fn from(v: InMemoryStorage) -> Storage

Converts to this type from the input type.
source§

impl KVStorage for InMemoryStorage

source§

fn available(&self) -> Result<(), Error>

Returns an error if the backend service is not online and available.
source§

fn get<V: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<V>, Error>

Retrieves a value from storage and fails if the backend is unavailable or the process has invalid permissions.
source§

fn set<V: Serialize>(&mut self, key: &str, value: V) -> Result<(), Error>

Sets a value in storage and fails if the backend is unavailable or the process has invalid permissions.
source§

fn reset_and_clear(&mut self) -> Result<(), Error>

Resets and clears all data held in the storage engine. Note: this should only be exposed and used for testing. Resetting the storage engine is not something that should be supported in production.
source§

impl TryInto<InMemoryStorage> for Storage

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_into( self ) -> Result<InMemoryStorage, <Self as TryInto<InMemoryStorage>>::Error>

Performs the conversion.
source§

impl CryptoKVStorage for InMemoryStorage

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · 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 Twhere U: From<T>,

const: unstable · 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · 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