MCPcopy Create free account
hub / github.com/bnjbvr/trinity / write

Function write

src/admin_table.rs:60–68  ·  view source on GitHub ↗

Writes a given key in the admin table from the database.

(db: &ShareableDatabase, key: &str, value: &[u8])

Source from the content-addressed store, hash-verified

58
59/// Writes a given key in the admin table from the database.
60pub fn write(db: &ShareableDatabase, key: &str, value: &[u8]) -> anyhow::Result<()> {
61 let txn = db.begin_write()?;
62 {
63 let mut table = txn.open_table(ADMIN_TABLE)?;
64 table.insert(key, value)?;
65 }
66 txn.commit()?;
67 Ok(())
68}
69
70/// Same as [`write`], but for a string ref.
71pub fn write_str(db: &ShareableDatabase, key: &str, value: &str) -> anyhow::Result<()> {

Callers 2

write_strFunction · 0.85
write_u64Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected