-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
19 additions
and
34 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `op-db-utils` | ||
|
||
Various utilities for working with the legacy Optimism data directories. |
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,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>(_: &T) { | ||
println!("{}", std::any::type_name::<T>()) | ||
} | ||
|
||
#[test] | ||
fn test_leveldb() { | ||
let db = LevelDB::new(PathBuf::from("testdb")); | ||
let ddb = db.database; | ||
dbg!(print_type_of(&db)); | ||
} | ||
} | ||
// todo |
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,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." |