From d3bcd89f6436e500caadd4cb4680ffeedf4080b3 Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Sat, 9 Mar 2019 18:55:54 -0500 Subject: [PATCH] stub out a block database and a state database for the stacks blockchain --- src/chainstate/stacks/db/blockdb.rs | 36 +++++++++++++++++++++++++++++ src/chainstate/stacks/db/mod.rs | 21 +++++++++++++++++ src/chainstate/stacks/db/statedb.rs | 22 ++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 src/chainstate/stacks/db/blockdb.rs create mode 100644 src/chainstate/stacks/db/mod.rs create mode 100644 src/chainstate/stacks/db/statedb.rs diff --git a/src/chainstate/stacks/db/blockdb.rs b/src/chainstate/stacks/db/blockdb.rs new file mode 100644 index 000000000..c8df2dd8b --- /dev/null +++ b/src/chainstate/stacks/db/blockdb.rs @@ -0,0 +1,36 @@ +/* + copyright: (c) 2013-2019 by Blockstack PBC, a public benefit corporation. + + This file is part of Blockstack. + + Blockstack is free software. You may redistribute or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License or + (at your option) any later version. + + Blockstack is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY, including without the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Blockstack. If not, see . +*/ + +use rusqlite::{Connection, OpenFlags, NO_PARAMS}; +use rusqlite::types::ToSql; +use rusqlite::Row; +use rusqlite::Transaction; + +use std::fs; +use std::convert::From; +use std::marker::PhantomData; + +use chainstate::{FromRow, RowOrder}; +use chainstate::ChainstateDB; +use chainstate::Error as db_error; + +use util::log; +use util::hash::{to_hex, hex_bytes, Hash160}; + + diff --git a/src/chainstate/stacks/db/mod.rs b/src/chainstate/stacks/db/mod.rs new file mode 100644 index 000000000..c28ba5a7b --- /dev/null +++ b/src/chainstate/stacks/db/mod.rs @@ -0,0 +1,21 @@ +/* + copyright: (c) 2013-2019 by Blockstack PBC, a public benefit corporation. + + This file is part of Blockstack. + + Blockstack is free software. You may redistribute or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License or + (at your option) any later version. + + Blockstack is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY, including without the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Blockstack. If not, see . +*/ + +pub mod blockdb; +pub mod statedb; diff --git a/src/chainstate/stacks/db/statedb.rs b/src/chainstate/stacks/db/statedb.rs new file mode 100644 index 000000000..1e36451e0 --- /dev/null +++ b/src/chainstate/stacks/db/statedb.rs @@ -0,0 +1,22 @@ +/* + copyright: (c) 2013-2019 by Blockstack PBC, a public benefit corporation. + + This file is part of Blockstack. + + Blockstack is free software. You may redistribute or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License or + (at your option) any later version. + + Blockstack is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY, including without the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Blockstack. If not, see . +*/ + +// HAMT? +// updateable history tree? +// -- on insert, update pointer to latest account version by address