Skip to content

Commit

Permalink
[FIX] Storage implement the Surveyee interface
Browse files Browse the repository at this point in the history
This is a proper fix for #323
  • Loading branch information
Florimond committed Jan 29, 2024
1 parent 8d839e0 commit 35a1a37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/broker/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func NewService(ctx context.Context, cfg *config.Config) (s *Service, err error)
s.surveyor = survey.New(s.pubsub, s.cluster)
s.presence = presence.New(s, s.pubsub, s.surveyor, s.subscriptions)
if s.cluster != nil {
s.surveyor.HandleFunc(s.presence, ssdstore, memstore)
s.surveyor.HandleFunc(s.storage)
}

// Create a new cipher from the licence provided
Expand Down
7 changes: 7 additions & 0 deletions internal/provider/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/emitter-io/config"
"github.com/emitter-io/emitter/internal/message"
"github.com/emitter-io/emitter/internal/security"
"github.com/emitter-io/emitter/internal/service/survey"

Check failure on line 25 in internal/provider/storage/storage.go

View workflow job for this annotation

GitHub Actions / Test with Coverage (1.20)

other declaration of survey
)

var (
Expand All @@ -37,6 +38,7 @@ const (
type Storage interface {
config.Provider
io.Closer
survey.Surveyee

// Store is used to store a message, the SSID provided must be a full SSID
// SSID, where first element should be a contract ID. The time resolution
Expand Down Expand Up @@ -137,3 +139,8 @@ func (s *Noop) Query(ssid message.Ssid, from, until time.Time, limit int) (messa
func (s *Noop) Close() error {
return nil
}

// OnSurvey handles an incoming cluster lookup request.
func (s *Noop) OnSurvey(surveyType string, payload []byte) ([]byte, bool) {
return []byte{}, true
}

0 comments on commit 35a1a37

Please sign in to comment.