Skip to content

Commit 99c9d6a

Browse files
authored
add ingester interface (#3352)
* use interface for ingester Signed-off-by: Mauro Stettler <[email protected]> * add comment
1 parent 2db4ef3 commit 99c9d6a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pkg/api/api.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/cortexproject/cortex/pkg/chunk/purger"
3131
"github.com/cortexproject/cortex/pkg/compactor"
3232
"github.com/cortexproject/cortex/pkg/distributor"
33-
"github.com/cortexproject/cortex/pkg/ingester"
3433
"github.com/cortexproject/cortex/pkg/ingester/client"
3534
"github.com/cortexproject/cortex/pkg/querier"
3635
"github.com/cortexproject/cortex/pkg/querier/frontend"
@@ -201,8 +200,17 @@ func (a *API) RegisterDistributor(d *distributor.Distributor, pushConfig distrib
201200
a.RegisterRoute("/ha-tracker", d.HATracker, false, "GET")
202201
}
203202

203+
// ingester is defined as an interface to allow for alternative implementations
204+
// of ingesters to be passed into the API.RegisterIngester() method.
205+
type ingester interface {
206+
client.IngesterServer
207+
FlushHandler(http.ResponseWriter, *http.Request)
208+
ShutdownHandler(http.ResponseWriter, *http.Request)
209+
Push(context.Context, *client.WriteRequest) (*client.WriteResponse, error)
210+
}
211+
204212
// RegisterIngester registers the ingesters HTTP and GRPC service
205-
func (a *API) RegisterIngester(i *ingester.Ingester, pushConfig distributor.Config) {
213+
func (a *API) RegisterIngester(i ingester, pushConfig distributor.Config) {
206214
client.RegisterIngesterServer(a.server.GRPC, i)
207215

208216
a.indexPage.AddLink(SectionDangerous, "/ingester/flush", "Trigger a Flush of data from Ingester to storage")

0 commit comments

Comments
 (0)