pub struct Database {
conn: Arc<Mutex<Connection>>,
}Expand description
Wrapper around the SQLite connection. Cheaply cloneable because
Connection is wrapped in a Mutex inside an Arc.
Fields§
§conn: Arc<Mutex<Connection>>Implementations§
Source§impl Database
impl Database
pub fn open(path: &Path) -> Result<Self>
pub fn init_schema(&self) -> Result<()>
pub fn append(&self, entry: &Entry) -> Result<u64>
pub fn entry_at(&self, sequence: u64) -> Result<Option<Entry>>
pub fn entry_count(&self) -> Result<u64>
pub fn entries_by_fingerprint( &self, fingerprint_hex: &str, ) -> Result<Vec<Entry>>
pub fn entries_by_issuer( &self, issuer_dn: &str, limit: usize, ) -> Result<Vec<Entry>>
Sourcepub fn all_leaf_hashes(&self) -> Result<Vec<[u8; 32]>>
pub fn all_leaf_hashes(&self) -> Result<Vec<[u8; 32]>>
Read every leaf hash in sequence order. Used to rebuild the Merkle tree on startup.
Sourcepub fn all_entries_for_rebuild(&self) -> Result<Vec<RebuildRow>>
pub fn all_entries_for_rebuild(&self) -> Result<Vec<RebuildRow>>
Every entry in append order, with the stored timestamp and type parsed back into domain types. The Merkle rebuild uses exactly these values so that leaf hashes — which cover the sequence, timestamp, and artifact hash — are identical before and after a restart.
pub fn store_ots_proof( &self, tree_size: u64, root_hash: &[u8; 32], ots_proof: &[u8], bitcoin_height: Option<u64>, ) -> Result<()>
pub fn get_ots_proof( &self, tree_size: u64, ) -> Result<Option<(Vec<u8>, Option<u64>, String)>>
pub fn store_witness_sig( &self, tree_size: u64, root_hash: &[u8; 32], witness_id: &str, signature: &[u8], ) -> Result<()>
pub fn witness_sigs_for_size( &self, tree_size: u64, ) -> Result<Vec<(String, Vec<u8>, String)>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Database
impl !UnwindSafe for Database
impl Freeze for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more