Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve sync header map #3391

Merged
merged 4 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions resource/ckb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ discovery_local_address = false # {{
# Ensure that itself can continue to serve as a bootnode node
bootnode_mode = false

# [network.sync.header_map]
# memory_limit = "600MB"

[rpc]
# By default RPC only binds to localhost, thus it only allows accessing from the same machine.
#
Expand Down
7 changes: 4 additions & 3 deletions sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ repository = "https://github.com/nervosnetwork/ckb"
ckb-chain = { path = "../chain", version = "= 0.104.0-pre" }
ckb-shared = { path = "../shared", version = "= 0.104.0-pre" }
ckb-store = { path = "../store", version = "= 0.104.0-pre" }
ckb-db = { path = "../db", version = "= 0.104.0-pre" }
ckb-app-config = {path = "../util/app-config", version = "= 0.104.0-pre"}
ckb-types = {path = "../util/types", version = "= 0.104.0-pre"}
ckb-network = { path = "../network", version = "= 0.104.0-pre" }
Expand All @@ -28,6 +27,9 @@ ckb-error = {path = "../error", version = "= 0.104.0-pre"}
ckb-tx-pool = { path = "../tx-pool", version = "= 0.104.0-pre" }
sentry = { version = "0.23.0", optional = true }
ckb-constant = { path = "../util/constant", version = "= 0.104.0-pre" }
ckb-async-runtime = { path = "../util/runtime", version = "= 0.104.0-pre" }
ckb-stop-handler = { path = "../util/stop-handler", version = "= 0.104.0-pre" }
tokio = { version = "1", features = ["sync"] }
lru = "0.7.1"
futures = "0.3"
governor = "0.3.1"
Expand All @@ -36,6 +38,7 @@ faketime = "0.2.0"
bitflags = "1.0"
dashmap = "4.0"
keyed_priority_queue = "0.3"
sled = "0.34.7"

[dev-dependencies]
ckb-test-chain-utils = { path = "../util/test-chain-utils", version = "= 0.104.0-pre" }
Expand All @@ -46,8 +49,6 @@ ckb-reward-calculator = { path = "../util/reward-calculator", version = "= 0.104
ckb-chain = { path = "../chain", version = "= 0.104.0-pre", features = ["mock"] }
ckb-launcher = { path = "../util/launcher", version = "= 0.104.0-pre" }
faux = "^0.1"
tokio = "1"
tempfile = "3.0"
once_cell = "1.8.0"

[features]
Expand Down
10 changes: 4 additions & 6 deletions sync/src/types/header_map/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ pub(crate) trait KeyValueBackend {
self.len() == 0
}

fn is_opened(&self) -> bool;
fn open(&mut self);
fn try_close(&mut self) -> bool;

fn contains_key(&self, key: &Byte32) -> bool;
fn get(&self, key: &Byte32) -> Option<HeaderView>;
fn insert(&mut self, value: &HeaderView) -> Option<HeaderView>;
fn remove(&mut self, key: &Byte32) -> Option<HeaderView>;
fn insert(&self, value: &HeaderView) -> Option<()>;
fn insert_batch(&self, values: &[HeaderView]);
fn remove(&self, key: &Byte32) -> Option<HeaderView>;
fn remove_no_return(&self, key: &Byte32);
}
168 changes: 0 additions & 168 deletions sync/src/types/header_map/backend_rocksdb.rs

This file was deleted.

Loading