From 6e34f052f3638e91bd122ea30ea55f8757120bd0 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 9 Jan 2024 06:57:06 -0500 Subject: [PATCH] feat: add NewHashRequest --- protocol/hash_query.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/protocol/hash_query.go b/protocol/hash_query.go index 7562e56..c2f4ecd 100644 --- a/protocol/hash_query.go +++ b/protocol/hash_query.go @@ -26,6 +26,16 @@ func NewHashQuery() *HashQuery { return &HashQuery{} } +func NewHashRequest(hash *encoding.Multihash, kinds []types.StorageLocationType) *HashQuery { + if len(kinds) == 0 { + kinds = []types.StorageLocationType{types.StorageLocationTypeFile} + } + return &HashQuery{ + hash: hash, + kinds: kinds, + } +} + func (h HashQuery) Hash() *encoding.Multihash { return h.hash }