separated ethcore_migrations from ethcore (#7586)
* separated ethcore_migrations from ethcore * fixed authorship nitpick * make ethcore_migrations related exports and imports more consistent
This commit is contained in:
parent
d429ce1849
commit
0c01db4a49
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -591,6 +591,25 @@ dependencies = [
|
||||
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethcore-migrations"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ethcore 1.9.0",
|
||||
"ethcore-bloom-journal 0.1.0",
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethereum-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"journaldb 0.1.0",
|
||||
"keccak-hash 0.1.0",
|
||||
"kvdb 0.1.0",
|
||||
"kvdb-rocksdb 0.1.0",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"macros 0.1.0",
|
||||
"migration 0.1.0",
|
||||
"patricia-trie 0.1.0",
|
||||
"rlp 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethcore-miner"
|
||||
version = "1.9.0"
|
||||
@ -1923,6 +1942,7 @@ dependencies = [
|
||||
"ethcore-io 1.9.0",
|
||||
"ethcore-light 1.9.0",
|
||||
"ethcore-logger 1.9.0",
|
||||
"ethcore-migrations 0.1.0",
|
||||
"ethcore-miner 1.9.0",
|
||||
"ethcore-network 1.9.0",
|
||||
"ethcore-secretstore 1.0.0",
|
||||
|
@ -39,6 +39,7 @@ ethcore-devtools = { path = "devtools" }
|
||||
ethcore-io = { path = "util/io" }
|
||||
ethcore-light = { path = "ethcore/light" }
|
||||
ethcore-logger = { path = "logger" }
|
||||
ethcore-migrations = { path = "ethcore/migrations" }
|
||||
ethcore-miner = { path = "miner" }
|
||||
ethcore-network = { path = "util/network" }
|
||||
ethcore-stratum = { path = "stratum" }
|
||||
|
19
ethcore/migrations/Cargo.toml
Normal file
19
ethcore/migrations/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "ethcore-migrations"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
ethcore-bytes = { path = "../../util/bytes" }
|
||||
ethereum-types = "0.1.4"
|
||||
keccak-hash = { path = "../../util/hash" }
|
||||
kvdb = { path = "../../util/kvdb" }
|
||||
kvdb-rocksdb = { path = "../../util/kvdb-rocksdb" }
|
||||
log = "0.3"
|
||||
macros = { path = "../../util/macros" }
|
||||
migration = { path = "../../util/migration" }
|
||||
rlp = { path = "../../util/rlp" }
|
||||
patricia-trie = { path = "../../util/patricia_trie" }
|
||||
journaldb = { path = "../../util/journaldb" }
|
||||
ethcore-bloom-journal = { path = "../../util/bloom" }
|
||||
ethcore = { path = ".." }
|
@ -16,6 +16,22 @@
|
||||
|
||||
//! Database migrations.
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate macros;
|
||||
extern crate migration;
|
||||
extern crate rlp;
|
||||
extern crate ethereum_types;
|
||||
extern crate ethcore_bytes as bytes;
|
||||
extern crate kvdb;
|
||||
extern crate kvdb_rocksdb;
|
||||
extern crate keccak_hash as hash;
|
||||
extern crate journaldb;
|
||||
extern crate ethcore_bloom_journal as bloom_journal;
|
||||
extern crate ethcore;
|
||||
extern crate patricia_trie as trie;
|
||||
|
||||
use migration::ChangeColumns;
|
||||
|
||||
pub mod state;
|
@ -17,10 +17,10 @@
|
||||
//! Bloom upgrade
|
||||
|
||||
use std::sync::Arc;
|
||||
use db::{COL_EXTRA, COL_HEADERS, COL_STATE};
|
||||
use state_db::{ACCOUNT_BLOOM_SPACE, DEFAULT_ACCOUNT_PRESET, StateDB};
|
||||
use ethcore::db::{COL_EXTRA, COL_HEADERS, COL_STATE};
|
||||
use ethcore::state_db::{ACCOUNT_BLOOM_SPACE, DEFAULT_ACCOUNT_PRESET, StateDB};
|
||||
use trie::TrieDB;
|
||||
use views::HeaderView;
|
||||
use ethcore::views::HeaderView;
|
||||
use bloom_journal::Bloom;
|
||||
use migration::{Error, Migration, Progress, Batch, Config, ErrorKind};
|
||||
use journaldb;
|
@ -138,13 +138,13 @@ pub mod ethereum;
|
||||
pub mod executed;
|
||||
pub mod header;
|
||||
pub mod machine;
|
||||
pub mod migrations;
|
||||
pub mod miner;
|
||||
pub mod pod_state;
|
||||
pub mod service;
|
||||
pub mod snapshot;
|
||||
pub mod spec;
|
||||
pub mod state;
|
||||
pub mod state_db;
|
||||
pub mod timer;
|
||||
pub mod trace;
|
||||
pub mod verification;
|
||||
@ -153,7 +153,6 @@ pub mod views;
|
||||
mod cache_manager;
|
||||
mod blooms;
|
||||
mod pod_account;
|
||||
mod state_db;
|
||||
mod account_db;
|
||||
mod builtin;
|
||||
mod executive;
|
||||
|
@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! State database abstraction.
|
||||
|
||||
use std::collections::{VecDeque, HashSet};
|
||||
use std::sync::Arc;
|
||||
use lru_cache::LruCache;
|
||||
@ -31,9 +33,13 @@ use bloom_journal::{Bloom, BloomJournal};
|
||||
use db::COL_ACCOUNT_BLOOM;
|
||||
use byteorder::{LittleEndian, ByteOrder};
|
||||
|
||||
/// Number of bytes allocated in the memory for accounts bloom.
|
||||
pub const ACCOUNT_BLOOM_SPACE: usize = 1048576;
|
||||
|
||||
/// Estimated maximum number of accounts in memory bloom.
|
||||
pub const DEFAULT_ACCOUNT_PRESET: usize = 1000000;
|
||||
|
||||
/// Database key represening number of account hashes.
|
||||
pub const ACCOUNT_BLOOM_HASHCOUNT_KEY: &'static [u8] = b"account_hash_count";
|
||||
|
||||
const STATE_CACHE_BLOCKS: usize = 12;
|
||||
@ -169,6 +175,7 @@ impl StateDB {
|
||||
bloom
|
||||
}
|
||||
|
||||
/// Commit bloom to a database transaction
|
||||
pub fn commit_bloom(batch: &mut DBTransaction, journal: BloomJournal) -> Result<(), UtilError> {
|
||||
assert!(journal.hash_functions <= 255);
|
||||
batch.put(COL_ACCOUNT_BLOOM, ACCOUNT_BLOOM_HASHCOUNT_KEY, &[journal.hash_functions as u8]);
|
||||
@ -298,10 +305,12 @@ impl StateDB {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns immutable reference to underlying hashdb.
|
||||
pub fn as_hashdb(&self) -> &HashDB {
|
||||
self.db.as_hashdb()
|
||||
}
|
||||
|
||||
/// Returns mutable reference to underlying hashdb.
|
||||
pub fn as_hashdb_mut(&mut self) -> &mut HashDB {
|
||||
self.db.as_hashdb_mut()
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ extern crate ethcore_devtools as devtools;
|
||||
extern crate ethcore_io as io;
|
||||
extern crate ethcore_light as light;
|
||||
extern crate ethcore_logger;
|
||||
extern crate ethcore_migrations as migrations;
|
||||
extern crate ethcore_miner as miner;
|
||||
extern crate ethcore_network as network;
|
||||
extern crate ethcore_transaction as transaction;
|
||||
|
@ -24,9 +24,8 @@ use journaldb::Algorithm;
|
||||
use migr::{self, Manager as MigrationManager, Config as MigrationConfig, Migration};
|
||||
use kvdb;
|
||||
use kvdb_rocksdb::{CompactionProfile, Database, DatabaseConfig};
|
||||
use ethcore::migrations;
|
||||
use migrations::{self, Extract};
|
||||
use ethcore::db;
|
||||
use ethcore::migrations::Extract;
|
||||
|
||||
/// Database is assumed to be at default version, when no version file is found.
|
||||
const DEFAULT_VERSION: u32 = 5;
|
||||
@ -284,7 +283,7 @@ mod legacy {
|
||||
use std::path::{Path, PathBuf};
|
||||
use migr::{Manager as MigrationManager};
|
||||
use kvdb_rocksdb::CompactionProfile;
|
||||
use ethcore::migrations;
|
||||
use migrations;
|
||||
|
||||
/// Blocks database path.
|
||||
pub fn blocks_database_path(path: &Path) -> PathBuf {
|
||||
|
Loading…
Reference in New Issue
Block a user