Documentation ¶
Index ¶
- Constants
- type DataRequest
- type DataResponse
- type Dispatcher
- func (dp *Dispatcher) GetData(peerIDs []string, datareq DataRequest)
- func (dp *Dispatcher) GetInventory(peerIDs []string, invreq InventoryRequest)
- func (dp Dispatcher) ID() string
- func (dp Dispatcher) LibP2PID() string
- func (dp *Dispatcher) PeerExists(peerID string) bool
- func (dp *Dispatcher) Peers() []string
- func (dp *Dispatcher) SendData(peerIDs []string, datarsp DataResponse)
- func (dp *Dispatcher) SendInventory(peerIDs []string, invrsp InventoryResponse)
- func (dp *Dispatcher) Start(ctx context.Context) error
- func (dp *Dispatcher) Stop()
- func (dp *Dispatcher) Wait()
- type InventoryRequest
- type InventoryResponse
Constants ¶
const MaxInventorySize = 50
MaxInventorySize defines the max number of items in InventoryRequest/InventoryResponse.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataRequest ¶
type DataRequest struct { ChannelID common.ChannelIDEnum Entries []string }
DataRequest defines the structure of the data request
type DataResponse ¶
type DataResponse struct { ChannelID common.ChannelIDEnum Payload common.Bytes }
DataResponse defines the structure of the data response
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher dispatches messages to approporiate destinations
func NewDispatcher ¶
func NewDispatcher(p2pnet p2p.Network, p2plnet p2pl.Network) *Dispatcher
NewLDispatcher returns the pointer to the Dispatcher singleton
func (*Dispatcher) GetData ¶
func (dp *Dispatcher) GetData(peerIDs []string, datareq DataRequest)
GetData sends out the DataRequest
func (*Dispatcher) GetInventory ¶
func (dp *Dispatcher) GetInventory(peerIDs []string, invreq InventoryRequest)
GetInventory sends out the InventoryRequest
func (Dispatcher) LibP2PID ¶
func (dp Dispatcher) LibP2PID() string
TODO: for 1.3.0 upgrade only, delete it after the upgrade completed ID returns the ID of the node
func (*Dispatcher) PeerExists ¶
func (dp *Dispatcher) PeerExists(peerID string) bool
PeerExists indicates if the given peerID is a neighboring peer
func (*Dispatcher) Peers ¶
func (dp *Dispatcher) Peers() []string
Peers returns the IDs of all peers
func (*Dispatcher) SendData ¶
func (dp *Dispatcher) SendData(peerIDs []string, datarsp DataResponse)
SendData sends out the DataResponse
func (*Dispatcher) SendInventory ¶
func (dp *Dispatcher) SendInventory(peerIDs []string, invrsp InventoryResponse)
SendInventory sends out the InventoryResponse
type InventoryRequest ¶
type InventoryRequest struct { ChannelID common.ChannelIDEnum Starts []string // Starting hashes. End string // Optional ending hash. }
InventoryRequest defines the structure of the inventory request
type InventoryResponse ¶
type InventoryResponse struct { ChannelID common.ChannelIDEnum Entries []string }
InventoryResponse defines the structure of the inventory response