diff --git a/node/node.go b/node/node.go index 0a21a264..502bb736 100644 --- a/node/node.go +++ b/node/node.go @@ -47,7 +47,7 @@ type Node struct { } // New creates a new Node. -func New(log zerolog.Logger, host *host.Host, store Store, fstore FStore, options ...Option) (*Node, error) { +func New(log zerolog.Logger, host *host.Host, store blockless.PeerStore, fstore FStore, options ...Option) (*Node, error) { // Initialize config. cfg := DefaultConfig diff --git a/node/notifiee.go b/node/notifiee.go index 7221a115..1fcc43a8 100644 --- a/node/notifiee.go +++ b/node/notifiee.go @@ -10,10 +10,10 @@ import ( type connectionNotifiee struct { log zerolog.Logger - store Store + store blockless.PeerStore } -func newConnectionNotifee(log zerolog.Logger, store Store) *connectionNotifiee { +func newConnectionNotifee(log zerolog.Logger, store blockless.PeerStore) *connectionNotifiee { cn := connectionNotifiee{ log: log.With().Str("component", "notifiee").Logger(), diff --git a/node/store.go b/node/store.go deleted file mode 100644 index f53041af..00000000 --- a/node/store.go +++ /dev/null @@ -1,9 +0,0 @@ -package node - -import ( - "github.com/blocklessnetwork/b7s/models/blockless" -) - -type Store interface { - SavePeer(blockless.Peer) error -} diff --git a/store/key.go b/store/key.go index 99f70c94..d56fc831 100644 --- a/store/key.go +++ b/store/key.go @@ -4,7 +4,6 @@ import ( "fmt" ) -// It's annoying having this function return an error, func encodeKey(prefix uint8, segments ...any) []byte { key := []byte{prefix} diff --git a/testing/mocks/store.go b/testing/mocks/store.go index 4ba4b490..5b8f7be0 100644 --- a/testing/mocks/store.go +++ b/testing/mocks/store.go @@ -15,7 +15,7 @@ type Store struct { RetrievePeersFunc func() ([]blockless.Peer, error) RetrieveFunctionFunc func(string) (blockless.FunctionRecord, error) RetrieveFunctionsFunc func() ([]blockless.FunctionRecord, error) - RemovePeerFunc func(string) error + RemovePeerFunc func(peer.ID) error RemoveFunctionFunc func(string) error } @@ -41,7 +41,7 @@ func BaselineStore(t *testing.T) *Store { RetrieveFunctionsFunc: func() ([]blockless.FunctionRecord, error) { return []blockless.FunctionRecord{GenericFunctionRecord}, nil }, - RemovePeerFunc: func(string) error { + RemovePeerFunc: func(peer.ID) error { return nil }, RemoveFunctionFunc: func(string) error { @@ -70,7 +70,7 @@ func (s *Store) RetrieveFunction(cid string) (blockless.FunctionRecord, error) { func (s *Store) RetrieveFunctions() ([]blockless.FunctionRecord, error) { return s.RetrieveFunctionsFunc() } -func (s *Store) RemovePeer(id string) error { +func (s *Store) RemovePeer(id peer.ID) error { return s.RemovePeerFunc(id) } func (s *Store) RemoveFunction(id string) error {