Skip to main content

TileStore

Trait TileStore 

Source
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§

Source

fn get(&self, path: &str) -> Result<Option<Vec<u8>>>

The bytes at path, or nothing when there is no such file.

Source

fn put(&self, path: &str, bytes: &[u8]) -> Result<()>

Writes bytes at path, whole or not at all, replacing what is there.

Source

fn create_new(&self, path: &str, bytes: &[u8]) -> Result<bool>

Writes bytes at path only when nothing is there; false when something is.

Source

fn delete(&self, path: &str) -> Result<bool>

Removes path; false when there was nothing to remove.

Source

fn rename(&self, from: &str, to: &str) -> Result<()>

Moves from to to, replacing what is at to.

Source

fn list(&self, prefix: &str) -> Result<Vec<String>>

Every file path under prefix (a directory path without a trailing slash, or the empty string for the whole store), sorted.

Provided Methods§

Source

fn exists(&self, path: &str) -> Result<bool>

Whether anything is stored at path.

Implementations on Foreign Types§

Source§

impl<T: TileStore + ?Sized> TileStore for &T

Source§

fn get(&self, path: &str) -> Result<Option<Vec<u8>>>

Source§

fn put(&self, path: &str, bytes: &[u8]) -> Result<()>

Source§

fn create_new(&self, path: &str, bytes: &[u8]) -> Result<bool>

Source§

fn delete(&self, path: &str) -> Result<bool>

Source§

fn rename(&self, from: &str, to: &str) -> Result<()>

Source§

fn list(&self, prefix: &str) -> Result<Vec<String>>

Source§

fn exists(&self, path: &str) -> Result<bool>

Source§

impl<T: TileStore + ?Sized> TileStore for Arc<T>

Source§

fn get(&self, path: &str) -> Result<Option<Vec<u8>>>

Source§

fn put(&self, path: &str, bytes: &[u8]) -> Result<()>

Source§

fn create_new(&self, path: &str, bytes: &[u8]) -> Result<bool>

Source§

fn delete(&self, path: &str) -> Result<bool>

Source§

fn rename(&self, from: &str, to: &str) -> Result<()>

Source§

fn list(&self, prefix: &str) -> Result<Vec<String>>

Source§

fn exists(&self, path: &str) -> Result<bool>

Implementors§