diff --git a/Cargo.lock b/Cargo.lock index 200108e248ca5f65be10ba1bf01f3681d48b9c6b..28e891852a01779621e66a00bb60a00c7e1fdd57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -409,6 +409,7 @@ dependencies = [ "dup-crypto-tests-tools 0.1.0", "durs-common-tools 0.1.0", "durs-wot 0.8.0-a0.9", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "id_tree 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rust-tests-tools 0.1.0", @@ -594,6 +595,11 @@ name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1479,6 +1485,7 @@ dependencies = [ "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31" diff --git a/lib/modules/blockchain/blockchain-dal/Cargo.toml b/lib/modules/blockchain/blockchain-dal/Cargo.toml index 9094dff1c627c9390659a2c3c6ba415e5cba4b43..0e23b44fcbb5f59a4e1b2daf90443d4ee6559ef5 100644 --- a/lib/modules/blockchain/blockchain-dal/Cargo.toml +++ b/lib/modules/blockchain/blockchain-dal/Cargo.toml @@ -15,6 +15,7 @@ dubp-documents= { path = "../../../tools/documents" } duniter-module = { path = "../../../core/module" } durs-common-tools = { path = "../../../tools/common-tools" } durs-wot = { path = "../../../tools/wot" } +fnv = "1.0.6" id_tree = "1.3.0" log = "0.4.*" rustbreak = {version = "2.0.0-rc3", features = ["bin_enc"]} diff --git a/lib/modules/blockchain/blockchain-dal/src/lib.rs b/lib/modules/blockchain/blockchain-dal/src/lib.rs index 35b6599e8a400135171556c3488938a75cc48e6b..14fe46f3768c58453e51611cf5b4811d03458bbd 100644 --- a/lib/modules/blockchain/blockchain-dal/src/lib.rs +++ b/lib/modules/blockchain/blockchain-dal/src/lib.rs @@ -58,6 +58,7 @@ use dubp_documents::{BlockHash, BlockId, Blockstamp, PreviousBlockstamp}; use dup_crypto::hashs::Hash; use dup_crypto::keys::*; use durs_wot::data::{rusty::RustyWebOfTrust, NodeId}; +use fnv::FnvHashMap; use rustbreak::backend::{FileBackend, MemoryBackend}; use rustbreak::error::{RustbreakError, RustbreakErrorKind}; use rustbreak::{deser::Bincode, Database, FileDatabase, MemoryDatabase}; @@ -78,7 +79,7 @@ use crate::writers::transaction::DALTxV10; /// Currency parameters (Protocol V10) pub type CurrencyParamsV10Datas = (CurrencyName, BlockV10Parameters); /// All blocks of local blockchain indexed by block number -pub type LocalBlockchainV10Datas = HashMap<BlockId, DALBlock>; +pub type LocalBlockchainV10Datas = FnvHashMap<BlockId, DALBlock>; /// Forks tree meta datas (block number and hash only) pub type ForksTreeV10Datas = entities::fork_tree::ForkTree; /// Forks blocks referenced in tree indexed by their blockstamp @@ -90,9 +91,9 @@ pub type WotDB = RustyWebOfTrust; /// V10 Identities indexed by public key pub type IdentitiesV10Datas = HashMap<PubKey, DALIdentity>; /// Memberships sorted by created block -pub type MsExpirV10Datas = HashMap<BlockId, HashSet<NodeId>>; +pub type MsExpirV10Datas = FnvHashMap<BlockId, HashSet<NodeId>>; /// Certifications sorted by created block -pub type CertsExpirV10Datas = HashMap<BlockId, HashSet<(NodeId, NodeId)>>; +pub type CertsExpirV10Datas = FnvHashMap<BlockId, HashSet<(NodeId, NodeId)>>; /// V10 Transactions indexed by their hashs pub type TxV10Datas = HashMap<Hash, DALTxV10>; /// V10 Unused Transaction Output (=sources)