[][src]Trait gf::kb::Kb

pub trait Kb {
    fn read<P: AsRef<Path>>(&self, path: P) -> Result<Cow<'_, TaggedData>>;
fn read_raw<P: AsRef<Path>>(&self, path: P) -> Result<Cow<'_, [u8]>>;
fn write<P: AsRef<Path>>(&mut self, path: P, data: TaggedData) -> Result<()>;
fn write_raw<P: AsRef<Path>>(
        &mut self,
        path: P,
        data: Vec<u8>
    ) -> Result<()>;
fn flush(&mut self) -> Result<()>; }

A knowledge base.

Required methods

fn read<P: AsRef<Path>>(&self, path: P) -> Result<Cow<'_, TaggedData>>

Read tagged data at path.

In addition to actual I/O errors, an std::io::ErrorKind::InvalidData can be returned if the path exists but stores untagged data. You can use read_raw to read both tagged and untagged data.

fn read_raw<P: AsRef<Path>>(&self, path: P) -> Result<Cow<'_, [u8]>>

Read raw data at path.

fn write<P: AsRef<Path>>(&mut self, path: P, data: TaggedData) -> Result<()>

Write tagged data at path, overwriting any existing entry.

This may not immediately update the storage. Call flush to persist changes.

fn write_raw<P: AsRef<Path>>(&mut self, path: P, data: Vec<u8>) -> Result<()>

Write raw data at path, overwriting any existing entry.

This may not immediately update the storage. Call flush to persist changes.

fn flush(&mut self) -> Result<()>

Flush written files to storage.

Loading content...

Implementors

impl Kb for TransientKb[src]

Loading content...