Skip to content

Commit

Permalink
Create RocksDb ledger in bin/fullnode
Browse files Browse the repository at this point in the history
  • Loading branch information
carllin committed Nov 22, 2018
1 parent 44d5b7a commit aceeefb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/bin/fullnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ extern crate log;
extern crate serde_json;
#[macro_use]
extern crate solana;
extern crate rocksdb;
extern crate solana_metrics;

use clap::{App, Arg};
use rocksdb::{Options, DB};
use solana::client::mk_client;
use solana::cluster_info::{Node, FULLNODE_PORT_RANGE};
use solana::db_ledger::{write_entries_to_ledger, DB_LEDGER_DIRECTORY};
use solana::fullnode::{Config, Fullnode, FullnodeReturnType};
use solana::leader_scheduler::LeaderScheduler;
use solana::ledger::read_ledger;
use solana::logger;
use solana::netutil::find_available_port_in_range;
use solana::signature::{Keypair, KeypairUtil};
Expand Down Expand Up @@ -85,6 +89,17 @@ fn main() {

let ledger_path = matches.value_of("ledger").unwrap();

// Create the RocksDb ledger
let db_ledger_path = format!("{}/{}", ledger_path, DB_LEDGER_DIRECTORY);
// Destroy old ledger
DB::destroy(&Options::default(), &db_ledger_path)
.expect("Expected successful database destruction");
let ledger_entries: Vec<_> = read_ledger(ledger_path, true)
.expect("opening ledger")
.map(|entry| entry.unwrap())
.collect();
write_entries_to_ledger(&vec![db_ledger_path], &ledger_entries[..]);

// socketaddr that is initial pointer into the network's gossip (ncp)
let network = matches
.value_of("network")
Expand Down

0 comments on commit aceeefb

Please sign in to comment.