darkfi/runtime/import/db/
mod.rs

1/* This file is part of DarkFi (https://dark.fi)
2 *
3 * Copyright (C) 2020-2026 Dyne.org foundation
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 */
18
19use darkfi_sdk::crypto::contract_id::ContractId;
20
21/// Internal wasm runtime API for sled trees or tx-local dbs
22#[derive(PartialEq)]
23pub struct DbHandle {
24    pub contract_id: ContractId,
25    pub tree: [u8; 32],
26}
27
28impl DbHandle {
29    pub fn new(contract_id: ContractId, tree: [u8; 32]) -> Self {
30        Self { contract_id, tree }
31    }
32}
33
34pub(crate) mod db_init;
35pub(crate) use db_init::db_init;
36
37pub(crate) mod db_lookup;
38pub(crate) use db_lookup::{db_lookup, db_lookup_local};
39
40pub(crate) mod db_set;
41pub(crate) use db_set::{db_set, db_set_local};
42
43pub(crate) mod db_del;
44pub(crate) use db_del::{db_del, db_del_local};
45
46pub(crate) mod db_get;
47pub(crate) use db_get::{db_get, db_get_local};
48
49pub(crate) mod db_contains_key;
50pub(crate) use db_contains_key::{db_contains_key, db_contains_key_local};
51
52pub(crate) mod zkas_db_set;
53pub(crate) use zkas_db_set::zkas_db_set;