Documentation ¶
Index ¶
- type MessageHandler
- func (mh *MessageHandler) FromMsgReader(p peer.ID, r msgio.Reader) (message.GraphSyncMessage, error)
- func (mh *MessageHandler) FromNet(p peer.ID, r io.Reader) (message.GraphSyncMessage, error)
- func (mh *MessageHandler) ToNet(p peer.ID, gsm message.GraphSyncMessage, w io.Writer) error
- func (mh *MessageHandler) ToProto(p peer.ID, gsm message.GraphSyncMessage) (*pb.Message, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageHandler ¶
type MessageHandler struct {
// contains filtered or unexported fields
}
MessageHandler is used to hold per-peer state for each connection. For the v1 protocol, we need to maintain a mapping of old style integer RequestIDs and the newer UUID forms. This happens on a per-peer basis and needs to work for both incoming and outgoing messages.
func NewMessageHandler ¶
func NewMessageHandler() *MessageHandler
NewMessageHandler instantiates a new MessageHandler instance
func (*MessageHandler) FromMsgReader ¶
func (mh *MessageHandler) FromMsgReader(p peer.ID, r msgio.Reader) (message.GraphSyncMessage, error)
FromMsgReader can deserialize a v1.0.0 protobuf message into a GraphySyncMessage
func (*MessageHandler) FromNet ¶
func (mh *MessageHandler) FromNet(p peer.ID, r io.Reader) (message.GraphSyncMessage, error)
FromNet can read a v1.0.0 network stream to deserialized a GraphSyncMessage
func (*MessageHandler) ToNet ¶
func (mh *MessageHandler) ToNet(p peer.ID, gsm message.GraphSyncMessage, w io.Writer) error
ToNet writes a GraphSyncMessage in its v1.0.0 protobuf format to a writer
func (*MessageHandler) ToProto ¶
func (mh *MessageHandler) ToProto(p peer.ID, gsm message.GraphSyncMessage) (*pb.Message, error)
toProto converts a GraphSyncMessage to its pb.Message equivalent
Click to show internal directories.
Click to hide internal directories.