pub trait Persist {
Show 23 methods
// Required methods
fn set(&mut self, key: Vec<u8>, value: Vec<u8>) -> Result<(), Global>;
fn _set_with_prefix(
&mut self,
key: Vec<u8>,
prefix: Vec<u8>,
value: Vec<u8>
) -> Result<(), Global>;
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Global>;
fn get_last(
&self,
scheduled: bool,
ts_before: Option<i64>
) -> Result<Option<(Vec<u8>, Vec<u8>)>, Global>;
fn _find(
&self,
prefix: &[u8],
options: Option<(u32, u32)>,
only_key: bool
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Global>;
fn find_with_direction(
&self,
key: &[u8],
before: bool,
options: Option<(u32, u32)>,
only_key: bool
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Global>;
fn append_digest(&self, new_item: Value) -> Result<(), Global>;
fn append_statements(
&self,
statements: Vec<(Vec<TypedStatement>, u128, String)>
) -> Result<(), Global>;
fn write_file(&self, file_name: &str, data: &[u8]) -> Result<(), Global>;
fn write_txn_hashes(
&mut self,
timestamp: i64,
genesis: bool,
data: &[u8],
only_touch: bool
) -> Result<(), Global>;
fn find_txn_hashes(&self, timestamp: i64) -> Result<(Vec<u8>, bool), Global>;
fn find_miss_txn_hash_files(
&self,
start_time: i64,
end_time: i64
) -> Result<Vec<(i64, i64)>, Global>;
fn clean_miss_txn_hash_files(&self) -> Result<(), Global>;
fn read_txn_hash_file(&self, num: i64) -> Result<Vec<u8>, Global>;
fn write_txn_hash_file(
&mut self,
num: i64,
data: &[u8]
) -> Result<(), Global>;
fn get_pre_file_cid(
&self,
timestamp: i64,
last_persist_ts: i64,
version: u16
) -> Result<Option<String>, Global>;
fn exist_txn_genesis_file(&self) -> Result<bool, Global>;
fn read_txn_genesis_file(&self) -> Result<Vec<u8>, Global>;
fn write_txn_genesis_file(&mut self, data: &[u8]) -> Result<(), Global>;
fn can_txn_hashes_sync(&self) -> Result<bool, Global>;
fn get_statements(
&self,
account_filter: Option<H160>,
date: Option<NaiveDate>,
max_size: u64,
read_to_end: &mut bool
) -> Result<Vec<(TypedStatement, String, String)>, Global>;
// Provided methods
fn set_with_prefix(
&mut self,
key: Vec<u8>,
prefix: Vec<u8>,
value: Vec<u8>
) -> Result<(), Global> { ... }
fn find(
&self,
prefix: &[u8],
options: Option<(u32, u32)>,
only_key: bool
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Global> { ... }
}
Required Methods§
fn set(&mut self, key: Vec<u8>, value: Vec<u8>) -> Result<(), Global>
fn _set_with_prefix( &mut self, key: Vec<u8>, prefix: Vec<u8>, value: Vec<u8> ) -> Result<(), Global>
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Global>
fn get_last( &self, scheduled: bool, ts_before: Option<i64> ) -> Result<Option<(Vec<u8>, Vec<u8>)>, Global>
fn _find(
&self,
prefix: &[u8],
options: Option<(u32, u32)>,
only_key: bool
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Global>
fn _find( &self, prefix: &[u8], options: Option<(u32, u32)>, only_key: bool ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Global>
find with prefix and return matched results
fn find_with_direction(
&self,
key: &[u8],
before: bool,
options: Option<(u32, u32)>,
only_key: bool
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Global>
fn find_with_direction( &self, key: &[u8], before: bool, options: Option<(u32, u32)>, only_key: bool ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Global>
If find the given key then return sequences before/after the key, else return error