tuweni / org.apache.tuweni.plumtree / State

State

class State (source)

Local state to our peer, representing the make-up of the tree of peers.

Constructors

<init>

Constructor using default time constants.

State(peerRepository: PeerRepository!, messageHashingFunction: MessageHashing!, messageSender: MessageSender!, messageListener: MessageListener!, messageValidator: MessageValidator!, peerPruningFunction: PeerPruning!)

Default constructor.

State(peerRepository: PeerRepository!, messageHashingFunction: MessageHashing!, messageSender: MessageSender!, messageListener: MessageListener!, messageValidator: MessageValidator!, peerPruningFunction: PeerPruning!, graftDelay: Long, lazyQueueInterval: Long)

Functions

addPeer

Adds a new peer to this state.

fun addPeer(peer: Peer!): Unit

receiveGossipMessage

Records a message was received in full from a peer.

fun receiveGossipMessage(peer: Peer!, attributes: String!, message: Bytes!, messageHash: Bytes!): Unit

receiveGraftMessage

Requests a peer be grafted to the eager peers list.

fun receiveGraftMessage(peer: Peer!, messageHash: Bytes!): Unit

receiveIHaveMessage

Records a message was partially received from a peer.

fun receiveIHaveMessage(peer: Peer!, messageHash: Bytes!): Unit

receivePruneMessage

Requests a peer be pruned away from the eager peers into the lazy peers.

fun receivePruneMessage(peer: Peer!): Unit

removePeer

Removes a peer from the collection of peers we are connected to.

fun removePeer(peer: Peer!): Unit

sendGossipMessage

Sends a gossip message to all peers, according to their status.

fun sendGossipMessage(attributes: String!, message: Bytes!): Bytes!

stop

Stops the gossip network state, cancelling all in progress tasks.

fun stop(): Unit