Rename spawn -> boxed_clone
This commit is contained in:
parent
d150529730
commit
ad86feb667
@ -212,7 +212,7 @@ impl<V> Client<V> where V: Verifier {
|
|||||||
// Enact Verified Block
|
// Enact Verified Block
|
||||||
let parent = chain_has_parent.unwrap();
|
let parent = chain_has_parent.unwrap();
|
||||||
let last_hashes = self.build_last_hashes(header.parent_hash.clone());
|
let last_hashes = self.build_last_hashes(header.parent_hash.clone());
|
||||||
let db = self.state_db.lock().unwrap().spawn();
|
let db = self.state_db.lock().unwrap().boxed_clone();
|
||||||
|
|
||||||
let enact_result = enact_verified(&block, engine, self.chain.have_tracing(), db, &parent, last_hashes);
|
let enact_result = enact_verified(&block, engine, self.chain.have_tracing(), db, &parent, last_hashes);
|
||||||
if let Err(e) = enact_result {
|
if let Err(e) = enact_result {
|
||||||
@ -342,7 +342,7 @@ impl<V> Client<V> where V: Verifier {
|
|||||||
|
|
||||||
/// Get a copy of the best block's state.
|
/// Get a copy of the best block's state.
|
||||||
pub fn state(&self) -> State {
|
pub fn state(&self) -> State {
|
||||||
State::from_existing(self.state_db.lock().unwrap().spawn(), HeaderView::new(&self.best_block_header()).state_root(), self.engine.account_start_nonce())
|
State::from_existing(self.state_db.lock().unwrap().boxed_clone(), HeaderView::new(&self.best_block_header()).state_root(), self.engine.account_start_nonce())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get info on the cache.
|
/// Get info on the cache.
|
||||||
@ -440,7 +440,7 @@ impl<V> BlockChainClient for Client<V> where V: Verifier {
|
|||||||
let mut b = OpenBlock::new(
|
let mut b = OpenBlock::new(
|
||||||
engine,
|
engine,
|
||||||
false, // TODO: this will need to be parameterised once we want to do immediate mining insertion.
|
false, // TODO: this will need to be parameterised once we want to do immediate mining insertion.
|
||||||
self.state_db.lock().unwrap().spawn(),
|
self.state_db.lock().unwrap().boxed_clone(),
|
||||||
match self.chain.block_header(&h) { Some(ref x) => x, None => { return (None, invalid_transactions) } },
|
match self.chain.block_header(&h) { Some(ref x) => x, None => { return (None, invalid_transactions) } },
|
||||||
self.build_last_hashes(h.clone()),
|
self.build_last_hashes(h.clone()),
|
||||||
author,
|
author,
|
||||||
|
@ -128,7 +128,7 @@ impl HashDB for ArchiveDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl JournalDB for ArchiveDB {
|
impl JournalDB for ArchiveDB {
|
||||||
fn spawn(&self) -> Box<JournalDB> {
|
fn boxed_clone(&self) -> Box<JournalDB> {
|
||||||
Box::new(ArchiveDB {
|
Box::new(ArchiveDB {
|
||||||
overlay: self.overlay.clone(),
|
overlay: self.overlay.clone(),
|
||||||
backing: self.backing.clone(),
|
backing: self.backing.clone(),
|
||||||
|
@ -320,7 +320,7 @@ impl HashDB for EarlyMergeDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl JournalDB for EarlyMergeDB {
|
impl JournalDB for EarlyMergeDB {
|
||||||
fn spawn(&self) -> Box<JournalDB> {
|
fn boxed_clone(&self) -> Box<JournalDB> {
|
||||||
Box::new(EarlyMergeDB {
|
Box::new(EarlyMergeDB {
|
||||||
overlay: self.overlay.clone(),
|
overlay: self.overlay.clone(),
|
||||||
backing: self.backing.clone(),
|
backing: self.backing.clone(),
|
||||||
|
@ -197,7 +197,7 @@ impl OverlayRecentDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl JournalDB for OverlayRecentDB {
|
impl JournalDB for OverlayRecentDB {
|
||||||
fn spawn(&self) -> Box<JournalDB> {
|
fn boxed_clone(&self) -> Box<JournalDB> {
|
||||||
Box::new(self.clone())
|
Box::new(self.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ impl HashDB for RefCountedDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl JournalDB for RefCountedDB {
|
impl JournalDB for RefCountedDB {
|
||||||
fn spawn(&self) -> Box<JournalDB> {
|
fn boxed_clone(&self) -> Box<JournalDB> {
|
||||||
Box::new(RefCountedDB {
|
Box::new(RefCountedDB {
|
||||||
forward: self.forward.clone(),
|
forward: self.forward.clone(),
|
||||||
backing: self.backing.clone(),
|
backing: self.backing.clone(),
|
||||||
|
@ -23,7 +23,7 @@ use hashdb::*;
|
|||||||
/// exclusive actions.
|
/// exclusive actions.
|
||||||
pub trait JournalDB : HashDB + Send + Sync {
|
pub trait JournalDB : HashDB + Send + Sync {
|
||||||
/// Return a copy of ourself, in a box.
|
/// Return a copy of ourself, in a box.
|
||||||
fn spawn(&self) -> Box<JournalDB>;
|
fn boxed_clone(&self) -> Box<JournalDB>;
|
||||||
|
|
||||||
/// Returns heap memory size used
|
/// Returns heap memory size used
|
||||||
fn mem_used(&self) -> usize;
|
fn mem_used(&self) -> usize;
|
||||||
|
Loading…
Reference in New Issue
Block a user