From 35a1a3734b0a2ac46ae09a65ed1b3b9a726e23f3 Mon Sep 17 00:00:00 2001 From: Florimond Husquinet Date: Mon, 29 Jan 2024 07:50:31 +0100 Subject: [PATCH] [FIX] Storage implement the Surveyee interface This is a proper fix for #323 --- internal/broker/service.go | 2 +- internal/provider/storage/storage.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/broker/service.go b/internal/broker/service.go index 53d7c46b..9860a938 100644 --- a/internal/broker/service.go +++ b/internal/broker/service.go @@ -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 diff --git a/internal/provider/storage/storage.go b/internal/provider/storage/storage.go index 257b8c18..408ddad7 100644 --- a/internal/provider/storage/storage.go +++ b/internal/provider/storage/storage.go @@ -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" ) var ( @@ -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 @@ -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 +}