libs5-go/protocol/hash_query.go

51 lines
871 B
Go
Raw Normal View History

2024-01-06 11:33:46 +00:00
package protocol
import (
libs5_go "git.lumeweb.com/LumeWeb/libs5-go"
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
"git.lumeweb.com/LumeWeb/libs5-go/net"
"github.com/vmihailenco/msgpack/v5"
)
var _ IncomingMessageTyped = (*HashQuery)(nil)
type HashQuery struct {
hash *encoding.Multihash
kinds []int
IncomingMessageTypedImpl
IncomingMessageHandler
}
func (h HashQuery) Hash() *encoding.Multihash {
return h.hash
}
func (h HashQuery) Kinds() []int {
return h.kinds
}
func (h *HashQuery) DecodeMessage(dec *msgpack.Decoder) error {
hash, err := dec.DecodeBytes()
if err != nil {
return err
}
h.hash = encoding.NewMultihash(hash)
var kinds []int
err = dec.Decode(&kinds)
if err != nil {
return err
}
h.kinds = kinds
return nil
}
func (h *HashQuery) HandleMessage(node *libs5_go.Node, peer *net.Peer, verifyId bool) error {
return nil
}