Struct jfs::Store
[−]
[src]
pub struct Store { /* fields omitted */ }
Methods
impl Store
[src]
pub fn new<P: AsRef<Path>>(path: P) -> Result<Store>
[src]
Opens a Store
against the specified path.
See new_with_cfg(..)
for more details
Arguments
path
- path to the db directory of JSON documents
pub fn new_with_cfg<P: AsRef<Path>>(path: P, cfg: Config) -> Result<Store>
[src]
Opens a Store
against the specified path with the given configuration
If the Store
already exists, it will be opened, otherwise this has the side-effect of creating the new Store
and the backing directories and files.
Arguments
path
- path to the db directory of JSON documents, if configured for single db mode then.json
will be used as the extension (replacing any existing extension)cfg
- configuration for the DB instance
pub fn path(&self) -> &Path
[src]
Returns the storage path for the backing JSON store.
In single-file-mode this will be the JSON file location, otherwise it's the directory in which all JSON objects are stored.
pub fn save<T>(&self, obj: &T) -> Result<String> where
T: Serialize + Deserialize<'de>,
[src]
T: Serialize + Deserialize<'de>,
pub fn save_with_id<T>(&self, obj: &T, id: &str) -> Result<String> where
T: Serialize + Deserialize<'de>,
[src]
T: Serialize + Deserialize<'de>,
pub fn get<T>(&self, id: &str) -> Result<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
pub fn all<T>(&self) -> Result<BTreeMap<String, T>> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,