Follow Shared prefix convention for Window alias (#798)
Follow Shared prefix convention for Window alias.
This commit is contained in:
parent
ea7fa11b3e
commit
308b6c3371
|
@ -33,7 +33,7 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread::{sleep, Builder, JoinHandle};
|
use std::thread::{sleep, Builder, JoinHandle};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use streamer::{BlobReceiver, BlobSender, Window, WindowIndex};
|
use streamer::{BlobReceiver, BlobSender, SharedWindow, WindowIndex};
|
||||||
use timing::timestamp;
|
use timing::timestamp;
|
||||||
use transaction::Vote;
|
use transaction::Vote;
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ impl Crdt {
|
||||||
pub fn broadcast(
|
pub fn broadcast(
|
||||||
me: &NodeInfo,
|
me: &NodeInfo,
|
||||||
broadcast_table: &[NodeInfo],
|
broadcast_table: &[NodeInfo],
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
s: &UdpSocket,
|
s: &UdpSocket,
|
||||||
transmit_index: &mut WindowIndex,
|
transmit_index: &mut WindowIndex,
|
||||||
received_index: u64,
|
received_index: u64,
|
||||||
|
@ -944,7 +944,7 @@ impl Crdt {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
fn run_window_request(
|
fn run_window_request(
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
me: &NodeInfo,
|
me: &NodeInfo,
|
||||||
from: &NodeInfo,
|
from: &NodeInfo,
|
||||||
ix: u64,
|
ix: u64,
|
||||||
|
@ -1010,7 +1010,7 @@ impl Crdt {
|
||||||
//TODO we should first coalesce all the requests
|
//TODO we should first coalesce all the requests
|
||||||
fn handle_blob(
|
fn handle_blob(
|
||||||
obj: &Arc<RwLock<Self>>,
|
obj: &Arc<RwLock<Self>>,
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
blob_recycler: &BlobRecycler,
|
blob_recycler: &BlobRecycler,
|
||||||
blob: &Blob,
|
blob: &Blob,
|
||||||
) -> Option<SharedBlob> {
|
) -> Option<SharedBlob> {
|
||||||
|
@ -1026,7 +1026,7 @@ impl Crdt {
|
||||||
fn handle_protocol(
|
fn handle_protocol(
|
||||||
request: Protocol,
|
request: Protocol,
|
||||||
obj: &Arc<RwLock<Self>>,
|
obj: &Arc<RwLock<Self>>,
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
blob_recycler: &BlobRecycler,
|
blob_recycler: &BlobRecycler,
|
||||||
) -> Option<SharedBlob> {
|
) -> Option<SharedBlob> {
|
||||||
match request {
|
match request {
|
||||||
|
@ -1122,7 +1122,7 @@ impl Crdt {
|
||||||
/// Process messages from the network
|
/// Process messages from the network
|
||||||
fn run_listen(
|
fn run_listen(
|
||||||
obj: &Arc<RwLock<Self>>,
|
obj: &Arc<RwLock<Self>>,
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
blob_recycler: &BlobRecycler,
|
blob_recycler: &BlobRecycler,
|
||||||
requests_receiver: &BlobReceiver,
|
requests_receiver: &BlobReceiver,
|
||||||
response_sender: &BlobSender,
|
response_sender: &BlobSender,
|
||||||
|
@ -1144,7 +1144,7 @@ impl Crdt {
|
||||||
}
|
}
|
||||||
pub fn listen(
|
pub fn listen(
|
||||||
obj: Arc<RwLock<Self>>,
|
obj: Arc<RwLock<Self>>,
|
||||||
window: Window,
|
window: SharedWindow,
|
||||||
blob_recycler: BlobRecycler,
|
blob_recycler: BlobRecycler,
|
||||||
requests_receiver: BlobReceiver,
|
requests_receiver: BlobReceiver,
|
||||||
response_sender: BlobSender,
|
response_sender: BlobSender,
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl FullNode {
|
||||||
entry_height: u64,
|
entry_height: u64,
|
||||||
node_info: &NodeInfo,
|
node_info: &NodeInfo,
|
||||||
blob_recycler: &BlobRecycler,
|
blob_recycler: &BlobRecycler,
|
||||||
) -> streamer::Window {
|
) -> streamer::SharedWindow {
|
||||||
match ledger_tail {
|
match ledger_tail {
|
||||||
Some(ledger_tail) => {
|
Some(ledger_tail) => {
|
||||||
// convert to blobs
|
// convert to blobs
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub struct Ncp {
|
||||||
impl Ncp {
|
impl Ncp {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
crdt: &Arc<RwLock<Crdt>>,
|
crdt: &Arc<RwLock<Crdt>>,
|
||||||
window: streamer::Window,
|
window: streamer::SharedWindow,
|
||||||
gossip_listen_socket: UdpSocket,
|
gossip_listen_socket: UdpSocket,
|
||||||
gossip_send_socket: UdpSocket,
|
gossip_send_socket: UdpSocket,
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub struct WindowSlot {
|
||||||
pub coding: Option<SharedBlob>,
|
pub coding: Option<SharedBlob>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Window = Arc<RwLock<Vec<WindowSlot>>>;
|
pub type SharedWindow = Arc<RwLock<Vec<WindowSlot>>>;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum WindowError {
|
pub enum WindowError {
|
||||||
|
@ -171,7 +171,7 @@ pub fn blob_receiver(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_next_missing(
|
fn find_next_missing(
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
crdt: &Arc<RwLock<Crdt>>,
|
crdt: &Arc<RwLock<Crdt>>,
|
||||||
consumed: u64,
|
consumed: u64,
|
||||||
received: u64,
|
received: u64,
|
||||||
|
@ -197,7 +197,7 @@ fn find_next_missing(
|
||||||
|
|
||||||
fn repair_window(
|
fn repair_window(
|
||||||
debug_id: u64,
|
debug_id: u64,
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
crdt: &Arc<RwLock<Crdt>>,
|
crdt: &Arc<RwLock<Crdt>>,
|
||||||
last: &mut u64,
|
last: &mut u64,
|
||||||
times: &mut usize,
|
times: &mut usize,
|
||||||
|
@ -319,7 +319,7 @@ fn process_blob(
|
||||||
blob: SharedBlob,
|
blob: SharedBlob,
|
||||||
pix: u64,
|
pix: u64,
|
||||||
consume_queue: &mut SharedBlobs,
|
consume_queue: &mut SharedBlobs,
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
recycler: &BlobRecycler,
|
recycler: &BlobRecycler,
|
||||||
consumed: &mut u64,
|
consumed: &mut u64,
|
||||||
) {
|
) {
|
||||||
|
@ -419,7 +419,7 @@ fn process_blob(
|
||||||
|
|
||||||
fn recv_window(
|
fn recv_window(
|
||||||
debug_id: u64,
|
debug_id: u64,
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
crdt: &Arc<RwLock<Crdt>>,
|
crdt: &Arc<RwLock<Crdt>>,
|
||||||
recycler: &BlobRecycler,
|
recycler: &BlobRecycler,
|
||||||
consumed: &mut u64,
|
consumed: &mut u64,
|
||||||
|
@ -515,7 +515,7 @@ fn recv_window(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_window(debug_id: u64, window: &Window, consumed: u64) -> String {
|
fn print_window(debug_id: u64, window: &SharedWindow, consumed: u64) -> String {
|
||||||
let pointer: Vec<_> = window
|
let pointer: Vec<_> = window
|
||||||
.read()
|
.read()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -559,7 +559,7 @@ fn print_window(debug_id: u64, window: &Window, consumed: u64) -> String {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_window() -> Window {
|
pub fn default_window() -> SharedWindow {
|
||||||
Arc::new(RwLock::new(vec![
|
Arc::new(RwLock::new(vec![
|
||||||
WindowSlot::default();
|
WindowSlot::default();
|
||||||
WINDOW_SIZE as usize
|
WINDOW_SIZE as usize
|
||||||
|
@ -594,7 +594,7 @@ pub fn initialized_window(
|
||||||
node_info: &NodeInfo,
|
node_info: &NodeInfo,
|
||||||
blobs: Vec<SharedBlob>,
|
blobs: Vec<SharedBlob>,
|
||||||
entry_height: u64,
|
entry_height: u64,
|
||||||
) -> Window {
|
) -> SharedWindow {
|
||||||
let window = default_window();
|
let window = default_window();
|
||||||
let debug_id = node_info.debug_id();
|
let debug_id = node_info.debug_id();
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ pub fn initialized_window(
|
||||||
|
|
||||||
pub fn window(
|
pub fn window(
|
||||||
crdt: Arc<RwLock<Crdt>>,
|
crdt: Arc<RwLock<Crdt>>,
|
||||||
window: Window,
|
window: SharedWindow,
|
||||||
entry_height: u64,
|
entry_height: u64,
|
||||||
recycler: BlobRecycler,
|
recycler: BlobRecycler,
|
||||||
r: BlobReceiver,
|
r: BlobReceiver,
|
||||||
|
@ -676,7 +676,7 @@ pub fn window(
|
||||||
fn broadcast(
|
fn broadcast(
|
||||||
node_info: &NodeInfo,
|
node_info: &NodeInfo,
|
||||||
broadcast_table: &[NodeInfo],
|
broadcast_table: &[NodeInfo],
|
||||||
window: &Window,
|
window: &SharedWindow,
|
||||||
recycler: &BlobRecycler,
|
recycler: &BlobRecycler,
|
||||||
r: &BlobReceiver,
|
r: &BlobReceiver,
|
||||||
sock: &UdpSocket,
|
sock: &UdpSocket,
|
||||||
|
@ -786,7 +786,7 @@ fn broadcast(
|
||||||
pub fn broadcaster(
|
pub fn broadcaster(
|
||||||
sock: UdpSocket,
|
sock: UdpSocket,
|
||||||
crdt: Arc<RwLock<Crdt>>,
|
crdt: Arc<RwLock<Crdt>>,
|
||||||
window: Window,
|
window: SharedWindow,
|
||||||
entry_height: u64,
|
entry_height: u64,
|
||||||
recycler: BlobRecycler,
|
recycler: BlobRecycler,
|
||||||
r: BlobReceiver,
|
r: BlobReceiver,
|
||||||
|
|
10
src/tvu.rs
10
src/tvu.rs
|
@ -29,7 +29,7 @@
|
||||||
//!
|
//!
|
||||||
//! 1. Fetch Stage
|
//! 1. Fetch Stage
|
||||||
//! - Incoming blobs are picked up from the replicate socket and repair socket.
|
//! - Incoming blobs are picked up from the replicate socket and repair socket.
|
||||||
//! 2. Window Stage
|
//! 2. SharedWindow Stage
|
||||||
//! - Blobs are windowed until a contiguous chunk is available. This stage also repairs and
|
//! - Blobs are windowed until a contiguous chunk is available. This stage also repairs and
|
||||||
//! retransmits blobs that are in the queue.
|
//! retransmits blobs that are in the queue.
|
||||||
//! 3. Replicate Stage
|
//! 3. Replicate Stage
|
||||||
|
@ -47,7 +47,7 @@ use std::net::UdpSocket;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread::{self, JoinHandle};
|
use std::thread::{self, JoinHandle};
|
||||||
use streamer::Window;
|
use streamer::SharedWindow;
|
||||||
use window_stage::WindowStage;
|
use window_stage::WindowStage;
|
||||||
|
|
||||||
pub struct Tvu {
|
pub struct Tvu {
|
||||||
|
@ -73,7 +73,7 @@ impl Tvu {
|
||||||
bank: &Arc<Bank>,
|
bank: &Arc<Bank>,
|
||||||
entry_height: u64,
|
entry_height: u64,
|
||||||
crdt: Arc<RwLock<Crdt>>,
|
crdt: Arc<RwLock<Crdt>>,
|
||||||
window: Window,
|
window: SharedWindow,
|
||||||
replicate_socket: UdpSocket,
|
replicate_socket: UdpSocket,
|
||||||
repair_socket: UdpSocket,
|
repair_socket: UdpSocket,
|
||||||
retransmit_socket: UdpSocket,
|
retransmit_socket: UdpSocket,
|
||||||
|
@ -156,7 +156,7 @@ pub mod tests {
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use streamer::{self, Window};
|
use streamer::{self, SharedWindow};
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
use tvu::Tvu;
|
use tvu::Tvu;
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ pub mod tests {
|
||||||
crdt: Arc<RwLock<Crdt>>,
|
crdt: Arc<RwLock<Crdt>>,
|
||||||
listen: UdpSocket,
|
listen: UdpSocket,
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
) -> Result<(Ncp, Window)> {
|
) -> Result<(Ncp, SharedWindow)> {
|
||||||
let window = streamer::default_window();
|
let window = streamer::default_window();
|
||||||
let send_sock = UdpSocket::bind("0.0.0.0:0").expect("bind 0");
|
let send_sock = UdpSocket::bind("0.0.0.0:0").expect("bind 0");
|
||||||
let ncp = Ncp::new(&crdt, window.clone(), listen, send_sock, exit)?;
|
let ncp = Ncp::new(&crdt, window.clone(), listen, send_sock, exit)?;
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::net::UdpSocket;
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread::{self, JoinHandle};
|
use std::thread::{self, JoinHandle};
|
||||||
use streamer::{self, BlobReceiver, Window};
|
use streamer::{self, BlobReceiver, SharedWindow};
|
||||||
|
|
||||||
pub struct WindowStage {
|
pub struct WindowStage {
|
||||||
thread_hdls: Vec<JoinHandle<()>>,
|
thread_hdls: Vec<JoinHandle<()>>,
|
||||||
|
@ -16,7 +16,7 @@ pub struct WindowStage {
|
||||||
impl WindowStage {
|
impl WindowStage {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
crdt: &Arc<RwLock<Crdt>>,
|
crdt: &Arc<RwLock<Crdt>>,
|
||||||
window: Window,
|
window: SharedWindow,
|
||||||
entry_height: u64,
|
entry_height: u64,
|
||||||
retransmit_socket: UdpSocket,
|
retransmit_socket: UdpSocket,
|
||||||
blob_recycler: &BlobRecycler,
|
blob_recycler: &BlobRecycler,
|
||||||
|
|
Loading…
Reference in New Issue