pub trait TileStore {
// Required methods
fn get(&self, path: &str) -> Result<Option<Vec<u8>>>;
fn put(&self, path: &str, bytes: &[u8]) -> Result<()>;
fn create_new(&self, path: &str, bytes: &[u8]) -> Result<bool>;
fn delete(&self, path: &str) -> Result<bool>;
fn rename(&self, from: &str, to: &str) -> Result<()>;
fn list(&self, prefix: &str) -> Result<Vec<String>>;
// Provided method
fn exists(&self, path: &str) -> Result<bool> { ... }
}Expand description
Byte storage keyed by store path.
Required Methods§
Sourcefn get(&self, path: &str) -> Result<Option<Vec<u8>>>
fn get(&self, path: &str) -> Result<Option<Vec<u8>>>
The bytes at path, or nothing when there is no such file.
Sourcefn put(&self, path: &str, bytes: &[u8]) -> Result<()>
fn put(&self, path: &str, bytes: &[u8]) -> Result<()>
Writes bytes at path, whole or not at all, replacing what is there.
Sourcefn create_new(&self, path: &str, bytes: &[u8]) -> Result<bool>
fn create_new(&self, path: &str, bytes: &[u8]) -> Result<bool>
Writes bytes at path only when nothing is there; false when
something is.
Sourcefn delete(&self, path: &str) -> Result<bool>
fn delete(&self, path: &str) -> Result<bool>
Removes path; false when there was nothing to remove.