Documentation ¶
Index ¶
- Constants
- func ByteToPacket(b []byte) (Packet, Peer)
- func BytesToView(bytes []byte) (View, Peer, error)
- func Listen(ctx context.Context, port string, gossipCb func(Packet, Peer) []byte, ...)
- func PrintView(view View) string
- func ViewToBytes(view View, from Peer) []byte
- type Gossip
- type Packet
- type Peer
- type PeerSamplingStrategy
- type View
Constants ¶
View Source
const ( ViewExchangeDelay = 200 * time.Millisecond // timeout after which a View is exchanged with a peer MaxNodesInView = 6 // max peers kept in local View TODO MaxNodesInView=6 )
View Source
const ( Random = iota // *selection strategies Head // *selection strategies Tail // *selection strategies Push // *propagation strategies Pull // *propagation strategies PushPull // *propagation strategies )
Variables ¶
This section is empty.
Functions ¶
func ByteToPacket ¶
func Listen ¶
func Listen(ctx context.Context, port string, gossipCb func(Packet, Peer) []byte, viewCb func(View, Peer) []byte)
Listen starts the udp server that listens for an incoming view or startRounds from peers. Responds with the current view / startRounds as per strategy.
func ViewToBytes ¶
Types ¶
type Gossip ¶
type Packet ¶
type Packet struct { AvailableAt []string `json:"AvailableAt"` // at which addresses the data is available GossipMessage gossipMessage `json:"GossipMessage"` VectorClock vClock.EventClock `json:"VectorClock"` }
Packet exchanged between peers
func NewGossipMessage ¶
func NewGossipMessage(data string, from string, clock vClock.EventClock) Packet
NewGossipMessage creates a Gossip message with current timestamp, creating a unique hash for every message
func (*Packet) GetVersion ¶
func (*Packet) UpdateGossipAt ¶
func (p *Packet) UpdateGossipAt()
type PeerSamplingStrategy ¶
type PeerSamplingStrategy struct { PeerSelectionStrategy int ViewPropagationStrategy int ViewSelectionStrategy int }
func With ¶
func With(ps, vp, vs int) PeerSamplingStrategy
type View ¶
View of at max MaxNodesInView nodes in the network updated during selectView()
func (*View) RandomView ¶
func (v *View) RandomView()
RandomView sets the current View as a random subset of current View
Source Files ¶
Click to show internal directories.
Click to hide internal directories.