Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
// HandleInbound handles inbound messages
HandleInbound(ctx context.Context, msg HandlerMessage) error
// HandleOutbound handles outbound messages
HandleOutbound(ctx context.Context, msg HandlerMessage) error
// Connected handles node connection events
Connected(ctx context.Context, nodeID ids.NodeID) error
// Disconnected handles node disconnection events
Disconnected(ctx context.Context, nodeID ids.NodeID) error
}
Handler handles network messages for a specific chain
type HandlerMessage ¶
HandlerMessage represents a message for chain handlers
type InboundHandler ¶
type InboundHandler interface {
HandleInbound(ctx context.Context, msg message.InboundMessage)
}
InboundHandler handles inbound messages
type InboundHandlerFunc ¶
type InboundHandlerFunc func(ctx context.Context, msg message.InboundMessage)
InboundHandlerFunc is a function that implements InboundHandler
func (InboundHandlerFunc) HandleInbound ¶
func (f InboundHandlerFunc) HandleInbound(ctx context.Context, msg message.InboundMessage)
HandleInbound implements InboundHandler
type Op ¶
type Op byte
Op represents a network operation
const ( // GetAcceptedFrontier requests accepted frontier GetAcceptedFrontier Op = iota // AcceptedFrontier is accepted frontier response AcceptedFrontier // GetAccepted requests accepted items GetAccepted // Accepted is accepted items response Accepted // Get requests an item Get // Put provides an item Put // PushQuery sends a push query PushQuery // PullQuery sends a pull query PullQuery // Chits is query response Chits )
type Router ¶
type Router interface {
// HandleInbound handles an inbound message
HandleInbound(ctx context.Context, msg message.InboundMessage)
// RegisterHandler registers a handler for a specific chain
RegisterHandler(chainID ids.ID, handler Handler)
// UnregisterHandler removes a handler for a specific chain
UnregisterHandler(chainID ids.ID)
// Deprecated is required for backward compatibility
Deprecated()
}
Router is the main interface for message routing This replaces the deprecated consensus/networking/router package
type Sender ¶
type Sender interface {
// Send sends a message to the specified nodes
Send(ctx context.Context, msg Message) error
// SendAppRequest sends an app request to the specified nodes
SendAppRequest(ctx context.Context, nodeIDs []ids.NodeID, requestID uint32, payload []byte) error
// SendAppResponse sends an app response to a specific node
SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, payload []byte) error
// SendAppGossip sends app gossip to the specified nodes
SendAppGossip(ctx context.Context, nodeIDs []ids.NodeID, payload []byte) error
}
Sender sends messages to network peers
Click to show internal directories.
Click to hide internal directories.