Struct solana::crdt::Crdt [−][src]
pub struct Crdt { pub table: HashMap<PublicKey, NodeInfo>, pub remote: HashMap<PublicKey, u64>, pub alive: HashMap<PublicKey, u64>, pub update_index: u64, pub me: PublicKey, // some fields omitted }
Crdt
structure keeps a table of NodeInfo
structs
Properties
table
- map of public id's to versioned and signed NodeInfo structslocal
- map of public id's to whatself.update_index
self.table
was updatedremote
- map of public id's to theremote.update_index
was sentupdate_index
- my update index
Remarks
This implements two services, gossip
and listen
.
gossip
- asynchronously ask nodes to send updateslisten
- listen for requests and responses No attempt to keep track of timeouts or dropped requests is made, or should be.
Fields
table: HashMap<PublicKey, NodeInfo>
table of everyone in the network
remote: HashMap<PublicKey, u64>
The value of the remote update index that I have last seen This Node will ask external nodes for updates since the value in this list
alive: HashMap<PublicKey, u64>
last time the public key had sent us a message
update_index: u64
me: PublicKey
Methods
impl Crdt
[src]
impl Crdt
pub fn new(me: NodeInfo) -> Crdt
[src]
pub fn new(me: NodeInfo) -> Crdt
pub fn debug_id(&self) -> u64
[src]
pub fn debug_id(&self) -> u64
pub fn my_data(&self) -> &NodeInfo
[src]
pub fn my_data(&self) -> &NodeInfo
pub fn leader_data(&self) -> Option<&NodeInfo>
[src]
pub fn leader_data(&self) -> Option<&NodeInfo>
pub fn set_leader(&mut self, key: PublicKey)
[src]
pub fn set_leader(&mut self, key: PublicKey)
pub fn get_external_liveness_entry(
&self,
key: &PublicKey
) -> Option<&HashMap<PublicKey, u64>>
[src]
pub fn get_external_liveness_entry(
&self,
key: &PublicKey
) -> Option<&HashMap<PublicKey, u64>>
pub fn insert_vote(&mut self, pubkey: &PublicKey, v: &Vote, last_id: Hash)
[src]
pub fn insert_vote(&mut self, pubkey: &PublicKey, v: &Vote, last_id: Hash)
pub fn insert_votes(&mut self, votes: &[(PublicKey, Vote, Hash)])
[src]
pub fn insert_votes(&mut self, votes: &[(PublicKey, Vote, Hash)])
pub fn insert(&mut self, v: &NodeInfo)
[src]
pub fn insert(&mut self, v: &NodeInfo)
pub fn purge(&mut self, now: u64)
[src]
pub fn purge(&mut self, now: u64)
purge old validators TODO: we need a robust membership protocol http://asc.di.fct.unl.pt/~jleitao/pdf/dsn07-leitao.pdf challenging part is that we are on a permissionless network
pub fn index_blobs(
me: &NodeInfo,
blobs: &[SharedBlob],
receive_index: &mut u64
) -> Result<()>
[src]
pub fn index_blobs(
me: &NodeInfo,
blobs: &[SharedBlob],
receive_index: &mut u64
) -> Result<()>
pub fn compute_broadcast_table(&self) -> Vec<NodeInfo>
[src]
pub fn compute_broadcast_table(&self) -> Vec<NodeInfo>
compute broadcast table
Remarks
pub fn broadcast(
me: &NodeInfo,
broadcast_table: &[NodeInfo],
window: &Window,
s: &UdpSocket,
transmit_index: &mut u64,
received_index: u64
) -> Result<()>
[src]
pub fn broadcast(
me: &NodeInfo,
broadcast_table: &[NodeInfo],
window: &Window,
s: &UdpSocket,
transmit_index: &mut u64,
received_index: u64
) -> Result<()>
broadcast messages from the leader to layer 1 nodes
Remarks
We need to avoid having obj locked while doing any io, such as the send_to
pub fn retransmit(
obj: &Arc<RwLock<Self>>,
blob: &SharedBlob,
s: &UdpSocket
) -> Result<()>
[src]
pub fn retransmit(
obj: &Arc<RwLock<Self>>,
blob: &SharedBlob,
s: &UdpSocket
) -> Result<()>
retransmit messages from the leader to layer 1 nodes
Remarks
We need to avoid having obj locked while doing any io, such as the send_to
pub fn convergence(&self) -> u64
[src]
pub fn convergence(&self) -> u64
pub fn window_index_request(&self, ix: u64) -> Result<(SocketAddr, Vec<u8>)>
[src]
pub fn window_index_request(&self, ix: u64) -> Result<(SocketAddr, Vec<u8>)>
pub fn new_vote(
&mut self,
height: u64,
last_id: Hash
) -> Result<(Vote, SocketAddr)>
[src]
pub fn new_vote(
&mut self,
height: u64,
last_id: Hash
) -> Result<(Vote, SocketAddr)>
pub fn gossip(
obj: Arc<RwLock<Self>>,
blob_recycler: BlobRecycler,
blob_sender: BlobSender,
exit: Arc<AtomicBool>
) -> JoinHandle<()>
[src]
pub fn gossip(
obj: Arc<RwLock<Self>>,
blob_recycler: BlobRecycler,
blob_sender: BlobSender,
exit: Arc<AtomicBool>
) -> JoinHandle<()>
randomly pick a node and ask them for updates asynchronously
pub fn listen(
obj: Arc<RwLock<Self>>,
window: Window,
blob_recycler: BlobRecycler,
requests_receiver: BlobReceiver,
response_sender: BlobSender,
exit: Arc<AtomicBool>
) -> JoinHandle<()>
[src]
pub fn listen(
obj: Arc<RwLock<Self>>,
window: Window,
blob_recycler: BlobRecycler,
requests_receiver: BlobReceiver,
response_sender: BlobSender,
exit: Arc<AtomicBool>
) -> JoinHandle<()>