Move FullNode::new_window into window module

This commit is contained in:
Greg Fitzgerald
2018-08-09 13:40:47 -06:00
parent 2727067b94
commit dc2a840985
2 changed files with 23 additions and 20 deletions

View File

@@ -2,8 +2,10 @@
//!
use counter::Counter;
use crdt::{Crdt, NodeInfo};
use entry::Entry;
#[cfg(feature = "erasure")]
use erasure;
use ledger::Block;
use log::Level;
use packet::{BlobRecycler, SharedBlob, SharedBlobs, BLOB_SIZE};
use result::{Error, Result};
@@ -554,6 +556,21 @@ pub fn initialized_window(
window
}
pub fn new_window_from_entries(
ledger_tail: &[Entry],
entry_height: u64,
node_info: &NodeInfo,
blob_recycler: &BlobRecycler,
) -> SharedWindow {
// convert to blobs
let mut blobs = VecDeque::new();
ledger_tail.to_blobs(&blob_recycler, &mut blobs);
// flatten deque to vec
let blobs: Vec<_> = blobs.into_iter().collect();
initialized_window(&node_info, blobs, entry_height)
}
pub fn window(
crdt: Arc<RwLock<Crdt>>,
window: SharedWindow,