[][src]Trait ssb_db::SsbDb

pub trait SsbDb {
    fn append_batch<T: 'static + AsRef<[u8]>>(
        &self,
        feed_id: &Multikey,
        messages: &[T]
    ) -> Result<()>;
fn get_entry_by_key(&self, message_key: &Multihash) -> Result<Vec<u8>>;
fn get_entry_by_seq(
        &self,
        feed_id: &Multikey,
        sequence: i32
    ) -> Result<Option<Vec<u8>>>;
fn get_feed_latest_sequence(
        &self,
        feed_id: &Multikey
    ) -> Result<Option<i32>>;
fn get_entries_newer_than_sequence(
        &self,
        feed_id: &Multikey,
        sequence: i32,
        limit: Option<i64>,
        include_keys: bool,
        include_values: bool
    ) -> Result<Vec<Vec<u8>>>;
fn rebuild_indexes(&self) -> Result<()>; }

Required methods

fn append_batch<T: 'static + AsRef<[u8]>>(
    &self,
    feed_id: &Multikey,
    messages: &[T]
) -> Result<()>

Append a batch of valid ssb messages authored by the feed_id.

fn get_entry_by_key(&self, message_key: &Multihash) -> Result<Vec<u8>>

Get an entry by its ssb message key.

fn get_entry_by_seq(
    &self,
    feed_id: &Multikey,
    sequence: i32
) -> Result<Option<Vec<u8>>>

Get an entry by its sequence key + author.

fn get_feed_latest_sequence(&self, feed_id: &Multikey) -> Result<Option<i32>>

Get the latest sequence number for the given feed.

fn get_entries_newer_than_sequence(
    &self,
    feed_id: &Multikey,
    sequence: i32,
    limit: Option<i64>,
    include_keys: bool,
    include_values: bool
) -> Result<Vec<Vec<u8>>>

Get all the entries for the given feed_id, with a sequence larger than sequence.

You may limit the maximum number of entries to get.

You can control whether to include_keys, include_values, or both.

If include_values and include_values are both false get_entries_newer_than_sequence will return an Error.

fn rebuild_indexes(&self) -> Result<()>

You can rebuild the indexes in sqlite db (but not the offset file) if they become corrupted.

Loading content...

Implementors

impl SsbDb for SqliteSsbDb[src]

Loading content...