From 01dfc344227f2b1a863d8343acb683d941076f6c Mon Sep 17 00:00:00 2001 From: clabby Date: Sat, 18 Nov 2023 14:49:13 -0500 Subject: [PATCH] Add download script --- crates/db-utils/README.md | 3 +++ crates/db-utils/src/leveldb.rs | 35 +--------------------------------- download-datadir.sh | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 34 deletions(-) create mode 100755 download-datadir.sh diff --git a/crates/db-utils/README.md b/crates/db-utils/README.md index e69de29..a4570e1 100644 --- a/crates/db-utils/README.md +++ b/crates/db-utils/README.md @@ -0,0 +1,3 @@ +# `op-db-utils` + +Various utilities for working with the legacy Optimism data directories. diff --git a/crates/db-utils/src/leveldb.rs b/crates/db-utils/src/leveldb.rs index 60c3b3b..65b3dba 100644 --- a/crates/db-utils/src/leveldb.rs +++ b/crates/db-utils/src/leveldb.rs @@ -1,34 +1 @@ -use std::path::PathBuf; - -use leveldb::{database::Database, options::Options}; - -struct LevelDB { - path: PathBuf, - database: Database, -} - -impl LevelDB { - pub fn new(path: PathBuf) -> Self { - let options = Options::new(); - Self { - path, - database: Database::open(path.as_path(), options).unwrap(), - } - } -} - -#[cfg(test)] -mod test { - use super::*; - - fn print_type_of(_: &T) { - println!("{}", std::any::type_name::()) - } - - #[test] - fn test_leveldb() { - let db = LevelDB::new(PathBuf::from("testdb")); - let ddb = db.database; - dbg!(print_type_of(&db)); - } -} +// todo diff --git a/download-datadir.sh b/download-datadir.sh new file mode 100755 index 0000000..bd0e96d --- /dev/null +++ b/download-datadir.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo "Downloading Bedrock Goerli datadir from gcloud..." + +# Download the Bedrock Goerli datadir from gcloud +curl -L https://datadirs.optimism.io/goerli-bedrock.tar.zst --output goerli-bedrock.tar.zst + +echo "Done. Untarring..." + +# Untar the datadir +tar --zstd -xvf goerli-bedrock.tar.zst + +rm goerli-bedrock.tar.zst + +echo "Done."