pub struct MemoryStorage {
    pub password: Option<String>,
    pub cipher: Option<Cipher>,
    pub memory: Arc<RwLock<HashMap<String, Value>>>,
    pub vss_client: Option<Arc<MutinyVssClient>>,
}

Fields§

§password: Option<String>§cipher: Option<Cipher>§memory: Arc<RwLock<HashMap<String, Value>>>§vss_client: Option<Arc<MutinyVssClient>>

Implementations§

source§

impl MemoryStorage

source

pub fn new( password: Option<String>, cipher: Option<Cipher>, vss_client: Option<Arc<MutinyVssClient>> ) -> Self

source

pub async fn load_from_vss(&self) -> Result<(), MutinyError>

Trait Implementations§

source§

impl Clone for MemoryStorage

source§

fn clone(&self) -> MemoryStorage

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 Default for MemoryStorage

source§

fn default() -> Self

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

impl MutinyStorage for MemoryStorage

source§

fn password(&self) -> Option<&str>

Get the password used to encrypt the storage
source§

fn cipher(&self) -> Option<Cipher>

Get the encryption key used for storage
source§

fn vss_client(&self) -> Option<Arc<MutinyVssClient>>

Get the VSS client used for storage
source§

fn set<T>(&self, key: impl AsRef<str>, value: T) -> Result<(), MutinyError>where T: Serialize,

Set a value in the storage, the value will already be encrypted if needed
source§

fn get<T>(&self, key: impl AsRef<str>) -> Result<Option<T>, MutinyError>where T: for<'de> Deserialize<'de>,

Get a value from the storage, use get_data if you want the value to be decrypted
source§

fn delete(&self, keys: &[impl AsRef<str>]) -> Result<(), MutinyError>

Delete a set of values from the storage
source§

async fn start(&mut self) -> Result<(), MutinyError>

Start the storage, this will be called before any other methods
source§

fn stop(&self)

Stop the storage, this will be called when the application is shutting down
source§

fn connected(&self) -> Result<bool, MutinyError>

Check if the storage is connected
source§

fn scan_keys( &self, prefix: &str, suffix: Option<&str> ) -> Result<Vec<String>, MutinyError>

Scan the storage for keys with a given prefix and suffix, this will return a list of keys If this function does not properly filter the keys, it can cause major problems.
source§

fn change_password( &mut self, new: Option<String>, new_cipher: Option<Cipher> ) -> Result<(), MutinyError>

source§

async fn import(_json: Value) -> Result<(), MutinyError>

Override the storage with the new JSON object
source§

async fn clear() -> Result<(), MutinyError>

Deletes all data from the storage
source§

fn set_data<T>( &self, key: impl AsRef<str>, value: T, version: Option<u32> ) -> Result<(), MutinyError>where T: Serialize,

Set a value in the storage, the function will encrypt the value if needed
source§

fn get_data<T>(&self, key: impl AsRef<str>) -> Result<Option<T>, MutinyError>where T: for<'de> Deserialize<'de>,

Get a value from the storage, the function will decrypt the value if needed
source§

fn scan<T>( &self, prefix: &str, suffix: Option<&str> ) -> Result<HashMap<String, T>, MutinyError>where T: for<'de> Deserialize<'de>,

Scan the storage for keys with a given prefix and suffix, and then gets their values
source§

fn insert_mnemonic(&self, mnemonic: Mnemonic) -> Result<Mnemonic, MutinyError>

Insert a mnemonic into the storage
source§

fn get_mnemonic(&self) -> Result<Option<Mnemonic>, MutinyError>

Get the mnemonic from the storage
source§

fn change_password_and_rewrite_storage( &mut self, old: Option<String>, new: Option<String> ) -> Result<(), MutinyError>

source§

async fn delete_all(&self) -> Result<(), MutinyError>

Deletes all data from the storage and removes lock from VSS
source§

fn get_nodes(&self) -> Result<NodeStorage, MutinyError>

Gets the node indexes from storage
source§

fn insert_nodes(&self, nodes: NodeStorage) -> Result<(), MutinyError>

Inserts the node indexes into storage
source§

fn get_fee_estimates(&self) -> Result<Option<HashMap<String, f64>>, MutinyError>

Get the current fee estimates from storage The key is block target, the value is the fee in satoshis per byte
source§

fn insert_fee_estimates( &self, fees: HashMap<String, f64> ) -> Result<(), MutinyError>

Inserts the fee estimates into storage The key is block target, the value is the fee in satoshis per byte
source§

fn has_done_first_sync(&self) -> Result<bool, MutinyError>

source§

fn set_done_first_sync(&self) -> Result<(), MutinyError>

source§

fn get_device_id(&self) -> Result<String, MutinyError>

source§

fn get_device_lock(&self) -> Result<Option<DeviceLock>, MutinyError>

source§

fn set_device_lock(&self) -> Result<(), MutinyError>

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
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 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<S> LabelStorage for Swhere S: MutinyStorage,

source§

fn create_new_contact(&self, contact: Contact) -> Result<String, MutinyError>

Create a new contact and return the identifying label

source§

fn get_address_labels( &self ) -> Result<HashMap<String, Vec<String, Global>, RandomState>, MutinyError>

Get a map of addresses to labels. This can be used to get all the labels for an address
source§

fn get_invoice_labels( &self ) -> Result<HashMap<Bolt11Invoice, Vec<String, Global>, RandomState>, MutinyError>

Get a map of invoices to labels. This can be used to get all the labels for an invoice
source§

fn get_labels( &self ) -> Result<HashMap<String, LabelItem, RandomState>, MutinyError>

Get all the existing labels
source§

fn get_label( &self, label: impl AsRef<str> ) -> Result<Option<LabelItem>, MutinyError>

Get information about a label
source§

fn set_address_labels( &self, address: Address, labels: Vec<String, Global> ) -> Result<(), MutinyError>

Set the labels for an address, replacing any existing labels If you do not want to replace any existing labels, use get_address_labels to get the existing labels, add the new labels, and then use set_address_labels to set the new labels
source§

fn set_invoice_labels( &self, invoice: Bolt11Invoice, labels: Vec<String, Global> ) -> Result<(), MutinyError>

Set the labels for an invoice, replacing any existing labels If you do not want to replace any existing labels, use get_invoice_labels to get the existing labels, add the new labels, and then use set_invoice_labels to set the new labels
source§

fn get_contacts( &self ) -> Result<HashMap<String, Contact, RandomState>, MutinyError>

Get all the existing contacts
source§

fn get_contact( &self, label: impl AsRef<str> ) -> Result<Option<Contact>, MutinyError>

Get a contact by label, the label should be a uuid
source§

fn create_contact_from_label( &self, label: impl AsRef<str>, contact: Contact ) -> Result<String, MutinyError>

Create a new contact from an existing label and returns the new identifying label
source§

fn archive_contact(&self, id: impl AsRef<str>) -> Result<(), MutinyError>

Marks a contact as archived
source§

fn edit_contact( &self, id: impl AsRef<str>, contact: Contact ) -> Result<(), MutinyError>

Edits an existing contact and replaces the existing contact
source§

fn get_tag_items(&self) -> Result<Vec<TagItem, Global>, MutinyError>

Gets all the existing tags (labels and contacts)
source§

impl<S> RedshiftStorage for Swhere S: MutinyStorage,

source§

impl<T> Same<T> 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