Documentation
¶
Overview ¶
Package sender provides p2p.Sender implementations over ZAP and gRPC transports.
ZAP is the default transport with zero-copy serialization and minimal overhead. gRPC support can be added with the grpc build tag for testing compatibility.
Build tags:
go build # ZAP only (default, production) go build -tags=grpc # gRPC support (for testing/compatibility)
Usage:
// ZAP transport (default) s := sender.ZAP(zapConn) // gRPC transport (requires -tags=grpc) s := sender.GRPC(senderpb.NewSenderClient(grpcConn))
Both return p2p.Sender with identical behavior, just different wire protocol. ZAP provides ~5-10x faster serialization and ~30-50% lower CPU usage.
Index ¶
- func NewZAPClient(conn *zapwire.Conn) p2p.Sender
- func ZAP(conn *zapwire.Conn) p2p.Sender
- type ZAPServer
- func (s *ZAPServer) Handle(ctx context.Context, msgType zapwire.MessageType, payload []byte) error
- func (s *ZAPServer) HandleSendError(ctx context.Context, payload []byte) error
- func (s *ZAPServer) HandleSendGossip(ctx context.Context, payload []byte) error
- func (s *ZAPServer) HandleSendRequest(ctx context.Context, payload []byte) error
- func (s *ZAPServer) HandleSendResponse(ctx context.Context, payload []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewZAPClient ¶
NewZAPClient is an alias for ZAP for backwards compatibility. Deprecated: Use ZAP() instead.
Types ¶
type ZAPServer ¶
type ZAPServer struct {
// contains filtered or unexported fields
}
ZAPServer handles incoming ZAP sender messages and forwards them to warp.Sender
func NewZAPServer ¶
NewZAPServer returns a ZAP server that wraps a warp.Sender
func (*ZAPServer) HandleSendError ¶
HandleSendError handles a SendError message
func (*ZAPServer) HandleSendGossip ¶
HandleSendGossip handles a SendGossip message
func (*ZAPServer) HandleSendRequest ¶
HandleSendRequest handles a SendRequest message