Skip to content

Commit

Permalink
Add download script
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Nov 18, 2023
1 parent 3d4f54a commit 01dfc34
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
3 changes: 3 additions & 0 deletions crates/db-utils/README.md
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.
35 changes: 1 addition & 34 deletions crates/db-utils/src/leveldb.rs
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
15 changes: 15 additions & 0 deletions download-datadir.sh
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."

0 comments on commit 01dfc34

Please sign in to comment.