From 6510beddf2cf3f961f37e64b3624b82073d1d066 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 14 Mar 2024 06:53:31 -0400 Subject: [PATCH] refactor: switch to using structs.SetImpl --- protocol/hash_query.go | 8 ++++---- protocol/storage_location.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/protocol/hash_query.go b/protocol/hash_query.go index 3bf8d67..7a21874 100644 --- a/protocol/hash_query.go +++ b/protocol/hash_query.go @@ -4,8 +4,8 @@ import ( "git.lumeweb.com/LumeWeb/libs5-go/encoding" "git.lumeweb.com/LumeWeb/libs5-go/net" "git.lumeweb.com/LumeWeb/libs5-go/storage" + "git.lumeweb.com/LumeWeb/libs5-go/structs" "git.lumeweb.com/LumeWeb/libs5-go/types" - "github.com/emirpasic/gods/sets/hashset" "github.com/vmihailenco/msgpack/v5" "go.uber.org/zap" "log" @@ -146,7 +146,7 @@ func (h *HashQuery) HandleMessage(message IncomingMessageData) error { } } - var peers *hashset.Set + var peers *structs.SetImpl hashString, err := h.hash.ToString() logger.Debug("HashQuery", zap.Any("hashString", hashString)) if err != nil { @@ -154,7 +154,7 @@ func (h *HashQuery) HandleMessage(message IncomingMessageData) error { } peersVal, ok := mediator.HashQueryRoutingTable().Get(hashString) if ok { - peers = peersVal.(*hashset.Set) + peers = peersVal.(*structs.SetImpl) if !peers.Contains(peer.Id()) { peers.Add(peer.Id()) } @@ -162,7 +162,7 @@ func (h *HashQuery) HandleMessage(message IncomingMessageData) error { return nil } - peerList := hashset.New() + peerList := structs.NewSet() peerList.Add(peer.Id()) mediator.HashQueryRoutingTable().Put(hashString, peerList) diff --git a/protocol/storage_location.go b/protocol/storage_location.go index 2baabc5..7eb5bad 100644 --- a/protocol/storage_location.go +++ b/protocol/storage_location.go @@ -6,9 +6,9 @@ import ( "git.lumeweb.com/LumeWeb/libs5-go/encoding" "git.lumeweb.com/LumeWeb/libs5-go/net" "git.lumeweb.com/LumeWeb/libs5-go/storage" + "git.lumeweb.com/LumeWeb/libs5-go/structs" "git.lumeweb.com/LumeWeb/libs5-go/types" "git.lumeweb.com/LumeWeb/libs5-go/utils" - "github.com/emirpasic/gods/sets/hashset" "github.com/vmihailenco/msgpack/v5" "go.uber.org/zap" ) @@ -89,12 +89,12 @@ func (s *StorageLocation) HandleMessage(message IncomingMessageData) error { return err } - var list *hashset.Set + var list *structs.SetImpl listVal, ok := mediator.HashQueryRoutingTable().Get(hashStr) // Implement HashQueryRoutingTable method if !ok { - list = hashset.New() + list = structs.NewSet() } else { - list = listVal.(*hashset.Set) + list = listVal.(*structs.SetImpl) } for _, peerIdVal := range list.Values() {