Skip to content

Commit

Permalink
Update store type used
Browse files Browse the repository at this point in the history
  • Loading branch information
Maelkum committed May 9, 2024
1 parent 1c6c7f5 commit 0ae80c9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions node/notifiee.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
9 changes: 0 additions & 9 deletions node/store.go

This file was deleted.

1 change: 0 additions & 1 deletion store/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
6 changes: 3 additions & 3 deletions testing/mocks/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0ae80c9

Please sign in to comment.