Partially implemented db wrapper

Addresses issue #12
This commit is contained in:
Paul Hauner
2018-09-17 17:52:32 +10:00
parent 513972b75c
commit 33b1e6ddf4
5 changed files with 31 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
use super::db::DB;
use std::sync::Arc;
use super::db::ClientDB;
use slog::Logger;
pub enum BlockStatus {
@@ -14,7 +15,7 @@ pub enum BlockStatus {
pub fn process_unverified_blocks(
_serialized_block: &[u8],
_db: &DB,
_db: Arc<ClientDB>,
_log: Logger)
{
//

View File

@@ -1,5 +1,5 @@
use std::sync::Arc;
use super::db::DB;
use super::db::ClientDB;
use slog::Logger;
use super::network_libp2p::message::{
@@ -25,7 +25,7 @@ use super::futures::sync::mpsc::{
/// (e.g., libp2p) has an event to push up to the sync process.
pub fn handle_network_event(
event: NetworkEvent,
db: Arc<DB>,
db: Arc<ClientDB>,
network_tx: UnboundedSender<OutgoingMessage>,
log: Logger)
-> Result<(), ()>
@@ -39,7 +39,7 @@ pub fn handle_network_event(
if let Some(data) = event.data {
handle_network_message(
data,
&db,
db,
network_tx,
log)
} else {
@@ -56,7 +56,7 @@ pub fn handle_network_event(
/// (e.g., libp2p) has sent a message to us.
fn handle_network_message(
message: Vec<u8>,
db: &DB,
db: Arc<ClientDB>,
_network_tx: UnboundedSender<OutgoingMessage>,
log: Logger)
-> Result<(), ()>

View File

@@ -10,7 +10,7 @@ use super::network_libp2p::message::{
};
use super::network::handle_network_event;
use std::sync::Arc;
use super::db::DB;
use super::db::ClientDB;
use slog::Logger;
type NetworkSender = UnboundedSender<OutgoingMessage>;
@@ -25,7 +25,7 @@ type SyncReceiver = UnboundedReceiver<Vec<u8>>;
/// from the network and the RPC and update
/// the state.
pub fn run_sync_future(
db: Arc<DB>,
db: Arc<ClientDB>,
network_tx: NetworkSender,
network_rx: NetworkReceiver,
_sync_tx: SyncSender,