Struct juju::unitdata::Storage [−][src]
pub struct Storage { /* fields omitted */ }
A connection to the unit's Key/Value data Simple key value database for local unit state within charms. Values are automatically json encoded/decoded.
Methods
impl Storage
[src]
impl Storage
pub fn new(path: Option<PathBuf>) -> Result<Self, JujuError>
[src]
pub fn new(path: Option<PathBuf>) -> Result<Self, JujuError>
Connect to the unit's database
pub fn get<T>(&self, key: &str) -> Result<Option<T>, JujuError> where
T: Deserialize,
[src]
pub fn get<T>(&self, key: &str) -> Result<Option<T>, JujuError> where
T: Deserialize,
pub fn getrange(
&self,
key_prefix: &str,
strip: bool
) -> Result<HashMap<String, Value>, JujuError>
[src]
pub fn getrange(
&self,
key_prefix: &str,
strip: bool
) -> Result<HashMap<String, Value>, JujuError>
Get a range of keys starting with a common prefix as a mapping of keys to values.
pub fn update<T>(
&self,
mapping: HashMap<String, T>,
prefix: Option<String>
) -> Result<(), JujuError> where
T: Serialize,
[src]
pub fn update<T>(
&self,
mapping: HashMap<String, T>,
prefix: Option<String>
) -> Result<(), JujuError> where
T: Serialize,
Set the values of multiple keys at once. Accepts an optional prefix to apply to all keys before setting
pub fn unset(&self, key: &str) -> Result<(), JujuError>
[src]
pub fn unset(&self, key: &str) -> Result<(), JujuError>
Remove a key from the database entirely.
pub fn unsetrange(
&self,
keys: Option<Vec<String>>,
prefix: Option<String>
) -> Result<u32, JujuError>
[src]
pub fn unsetrange(
&self,
keys: Option<Vec<String>>,
prefix: Option<String>
) -> Result<u32, JujuError>
Remove a range of keys starting with a common prefix, from the database entirely. If keys is set to None it will delete all keys Returns number of rows deleted
pub fn set<T>(&self, key: &str, value: T) -> Result<(), JujuError> where
T: Serialize,
[src]
pub fn set<T>(&self, key: &str, value: T) -> Result<(), JujuError> where
T: Serialize,
Set a value in the database.
pub fn gethistory(&self, key: &str) -> Result<Vec<History>, JujuError>
[src]
pub fn gethistory(&self, key: &str) -> Result<Vec<History>, JujuError>