Trait lockchain_core::traits::Vault [−][src]
pub trait Vault<T>: Send where
T: Body, { fn new(name: &str, location: &str) -> Self; fn fetch(&mut self); fn pull(&mut self, name: &str); fn sync(&mut self); fn get_record(&self, name: &str) -> Option<&Record<T>>; fn contains(&self, name: &str) -> bool; fn add_record(&mut self, key: &str, category: &str, tags: Vec<&str>); fn delete_record(&mut self, record: &str) -> Option<Record<T>>; fn add_data(&mut self, record: &str, key: &str, data: Payload) -> Option<()>; fn get_data(&self, record: &str, key: &str) -> Option<&Payload>; }
Trait for an in-memory representation of a lockchain vault.
By itself it represents vault metadata (name, users, location) as well as a list of record headers.
To provide on-disk functionality it requires the -storage
trait library and for encrypted file access the -crypto
crate.
The body backend is being being generic with the Body
trait.
Required Methods
fn new(name: &str, location: &str) -> Self
A shared constructor for all vault implementations
fn fetch(&mut self)
Fetch metadata headers for all records
fn pull(&mut self, name: &str)
Pull a specific record from the backend
fn sync(&mut self)
Sync all changes back to the backend
fn get_record(&self, name: &str) -> Option<&Record<T>>
Get a complete record from this vault
fn contains(&self, name: &str) -> bool
Probe if a record is contained
fn add_record(&mut self, key: &str, category: &str, tags: Vec<&str>)
Add a new record to this vault
fn delete_record(&mut self, record: &str) -> Option<Record<T>>
Delete a record from this vault
fn add_data(&mut self, record: &str, key: &str, data: Payload) -> Option<()>
Add data to an existing record, overwriting existing fields
fn get_data(&self, record: &str, key: &str) -> Option<&Payload>
Get the (latest) value of a specific record data field