Documentation
¶
Index ¶
- func Broadcaster(sync *Sync, frame *network.Frame, outputConn net.PacketConn, ...)
- func New(bm *books.Accounts, blobsReceiver <-chan *network.Blobs)
- func SyncGenerator(sync *Sync, sleep time.Duration) <-chan *network.Blob
- func SyncListener(sync *Sync, input <-chan *network.Blobs) <-chan *network.Blobs
- func Transporter(sync *Sync, input <-chan *network.Blobs, outputConn net.PacketConn)
- type Addresses
- type GetUpdates
- type Node
- type NodeData
- type Sockets
- type Sync
- func (c *Sync) AllNodesExceptMe(me ed25519.PublicKey) []*NodeData
- func (c *Sync) ChangeProducer(key ed25519.PublicKey)
- func (c *Sync) ConnectedNodes() uint64
- func (c *Sync) Insert(info *NodeData)
- func (c *Sync) MyCopy() *NodeData
- func (c *Sync) MyNodeData() *NodeData
- func (c *Sync) ProducerNodeData() *NodeData
- func (c *Sync) RandomNode() (*NodeData, error)
- func (c *Sync) RemoteTableCopy() map[string]*NodeData
- func (c *Sync) String() string
- func (c *Sync) TableCopy() map[string]*NodeData
- type Updates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Broadcaster ¶
func Broadcaster(sync *Sync, frame *network.Frame, outputConn net.PacketConn, input chan *network.Blobs)
Broadcaster thread is responsible for broadcasting blocks from producer to signers
func SyncGenerator ¶
SyncGenerator thread sends sync request to the random node in every 100 millisecond
func SyncListener ¶
SyncListener is a thread responsible for receiving updates from sync channel TODO optimize: there should be pointers in Blobs
func Transporter ¶
func Transporter(sync *Sync, input <-chan *network.Blobs, outputConn net.PacketConn)
Transporter thread is responsible for transporting producer blocks to other signers
Types ¶
type Addresses ¶
type Addresses struct { Sync net.UDPAddr Replication net.UDPAddr Message net.UDPAddr Transaction net.UDPAddr Repair net.UDPAddr }
Addresses represents network addresses for different pipelines
type GetUpdates ¶
GetUpdates is struct for requesting updates for Sync
func (*GetUpdates) Deserialize ¶
func (req *GetUpdates) Deserialize(blob *network.Blob)
Deserialize method is for turning Blobs into GetUpdates
func (*GetUpdates) Serialize ¶
func (req *GetUpdates) Serialize() *network.Blob
Serialize method is for turning GetUpdates into blobs
type NodeData ¶
type NodeData struct { Self ed25519.PublicKey Version uint64 Addresses Addresses Producer ed25519.PublicKey ValidVDFValue block.VDFValue NodeType string NodeName string }
NodeData represents structure for replication through sync
func NewNodeData ¶
func NewNodeData(self ed25519.PublicKey, nodeType string, name string, sync net.UDPAddr, replication net.UDPAddr, request net.UDPAddr, transaction net.UDPAddr, repair net.UDPAddr) *NodeData
NewNodeData returns new NodeIno struct
type Sockets ¶
type Sockets struct { Sync net.PacketConn SyncSend net.PacketConn Messages net.PacketConn Replicate net.PacketConn Transaction net.PacketConn Respond net.PacketConn Broadcast net.PacketConn Repair net.PacketConn Transport net.PacketConn }
Sockets struct saves all sockets of the node
type Sync ¶
type Sync struct {
// contains filtered or unexported fields
}
Sync struct is responsible for replication
func (*Sync) AllNodesExceptMe ¶
AllNodesExceptMe returns all nodes from sync except me node
func (*Sync) ChangeProducer ¶
ChangeProducer updates producer with new one
func (*Sync) ConnectedNodes ¶
ConnectedNodes is responsible to calculate number of remote nodes
func (*Sync) MyNodeData ¶
MyNodeData returns my NodeData saved in the table
func (*Sync) ProducerNodeData ¶
ProducerNodeData returns producer's NodeData saved in the table
func (*Sync) RandomNode ¶
func (*Sync) RemoteTableCopy ¶
RemoteTableCopy returns a copy of the remote nodes
type Updates ¶
Updates is a struct for receiving updates for Sync
func (*Updates) Deserialize ¶
Deserialize method is for turning Blobs into Updates