pub trait SsbDb {
// Required methods
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§
Sourcefn append_batch<T: 'static + AsRef<[u8]>>(
&self,
feed_id: &Multikey,
messages: &[T],
) -> Result<()>
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.
Sourcefn get_entry_by_key(&self, message_key: &Multihash) -> Result<Vec<u8>>
fn get_entry_by_key(&self, message_key: &Multihash) -> Result<Vec<u8>>
Get an entry by its ssb message key.
Sourcefn get_entry_by_seq(
&self,
feed_id: &Multikey,
sequence: i32,
) -> Result<Option<Vec<u8>>>
fn get_entry_by_seq( &self, feed_id: &Multikey, sequence: i32, ) -> Result<Option<Vec<u8>>>
Get an entry by its sequence key + author.
Sourcefn get_feed_latest_sequence(&self, feed_id: &Multikey) -> Result<Option<i32>>
fn get_feed_latest_sequence(&self, feed_id: &Multikey) -> Result<Option<i32>>
Get the latest sequence number for the given feed.
Sourcefn 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 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.
Sourcefn rebuild_indexes(&self) -> Result<()>
fn rebuild_indexes(&self) -> Result<()>
You can rebuild the indexes in sqlite db (but not the offset file) if they become corrupted.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.