Writes a given key in the admin table from the database.
(db: &ShareableDatabase, key: &str, value: &[u8])
| 58 | |
| 59 | /// Writes a given key in the admin table from the database. |
| 60 | pub 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. |
| 71 | pub fn write_str(db: &ShareableDatabase, key: &str, value: &str) -> anyhow::Result<()> { |