-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
2847589
commit e069a33
Showing
39 changed files
with
1,386 additions
and
894 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,5 +99,3 @@ VRF | |
WebAssembly | ||
WebSocket | ||
zstd | ||
ParityDB | ||
benchmark/GD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "forest-filecoin" | ||
version = "0.16.0" | ||
version = "0.15.2" | ||
authors = ["ChainSafe Systems <[email protected]>"] | ||
repository = "https://github.com/ChainSafe/forest" | ||
edition = "2021" | ||
|
@@ -129,6 +129,7 @@ once_cell = "1.15" | |
parity-db = { version = "0.4.6", default-features = false } | ||
parking_lot = { version = "0.12", features = ["deadlock_detection"] } | ||
pathfinding = "4.3.1" | ||
pbr = "1.1" | ||
pin-project-lite = "0.2" | ||
positioned-io = "0.3.2" | ||
pretty_assertions = "1.3.0" | ||
|
@@ -183,6 +184,7 @@ tracing-loki = { version = "0.2", default-features = false, features = ["compat- | |
tracing-subscriber = { version = "0.3", features = ["env-filter"] } | ||
unsigned-varint = { version = "0.7", features = ["codec"] } | ||
url = { version = "2.3", features = ["serde"] } | ||
uuid = { version = "1.3", features = ['v4'] } | ||
walkdir = "2" | ||
zerocopy = { version = "0.7.9", features = ["derive"] } | ||
zstd = "0.13" | ||
|
@@ -207,7 +209,6 @@ num-bigint = { version = "0.4", features = ['quickcheck'] } | |
predicates = "3.0" | ||
proc-macro2 = { version = "1.0.68", default-features = false, features = ["span-locations"] } | ||
quickcheck = "1" | ||
quickcheck_async = "0.1.1" | ||
quickcheck_macros = "1" | ||
ra_ap_syntax = "0.0.183" | ||
regex-automata = "0.4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2019-2023 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use crate::utils::{db::file_backed_obj::FileBackedObject, encoding::from_slice_with_fallback}; | ||
use fvm_ipld_encoding::to_vec; | ||
|
||
use crate::blocks::*; | ||
|
||
impl FileBackedObject for TipsetKeys { | ||
fn serialize(&self) -> anyhow::Result<Vec<u8>> { | ||
Ok(to_vec(self)?) | ||
} | ||
|
||
fn deserialize(bytes: &[u8]) -> anyhow::Result<Self> { | ||
from_slice_with_fallback(bytes) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use std::path::Path; | ||
|
||
use crate::utils::db::file_backed_obj::FileBacked; | ||
|
||
use super::*; | ||
|
||
#[test] | ||
fn tipset_keys_round_trip() { | ||
let path = Path::new("src/blocks/tests/calibnet/HEAD"); | ||
let obj1: FileBacked<TipsetKeys> = | ||
FileBacked::load_from_file_or_create(path.into(), Default::default).unwrap(); | ||
let serialized = obj1.inner().serialize().unwrap(); | ||
let deserialized = TipsetKeys::deserialize(&serialized).unwrap(); | ||
|
||
assert_eq!(obj1.inner(), &deserialized); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,63 @@ | ||
// Copyright 2019-2023 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use std::sync::Arc; | ||
|
||
use crate::rpc_api::progress_api::GetProgressType; | ||
use crate::rpc_client::ApiInfo; | ||
use crate::utils::io::ProgressBar; | ||
use chrono::Utc; | ||
use clap::Subcommand; | ||
|
||
#[derive(Debug, Subcommand)] | ||
pub enum DBCommands { | ||
// This is a noop as the manual GC is no longer available. | ||
#[command(hide = true)] | ||
/// Run DB garbage collection | ||
GC, | ||
} | ||
|
||
impl DBCommands { | ||
pub async fn run(self) -> anyhow::Result<()> { | ||
pub async fn run(self, api: ApiInfo) -> anyhow::Result<()> { | ||
match self { | ||
Self::GC => anyhow::bail!("manual garbage collection has been deprecated"), | ||
Self::GC => { | ||
let start = Utc::now(); | ||
|
||
let bar = Arc::new(tokio::sync::Mutex::new({ | ||
let bar = ProgressBar::new(0); | ||
bar.message("Running database garbage collection | blocks "); | ||
bar | ||
})); | ||
tokio::spawn({ | ||
let bar = bar.clone(); | ||
let api = api.clone(); | ||
async move { | ||
let mut interval = | ||
tokio::time::interval(tokio::time::Duration::from_secs(1)); | ||
loop { | ||
interval.tick().await; | ||
if let Ok((progress, total)) = api | ||
.get_progress(GetProgressType::DatabaseGarbageCollection) | ||
.await | ||
{ | ||
let bar = bar.lock().await; | ||
if bar.is_finish() { | ||
break; | ||
} | ||
bar.set_total(total); | ||
bar.set(progress); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
api.db_gc().await?; | ||
|
||
bar.lock().await.finish_println(&format!( | ||
"Database garbage collection completed. took {}s", | ||
(Utc::now() - start).num_seconds() | ||
)); | ||
|
||
Ok(()) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.