Skip to content

Commit b141863

Browse files
committed
fixup! fixup! Implement PrefetchBloomBlocks gRPC method on gateway
Signed-off-by: Christian Haudum <[email protected]>
1 parent a90607d commit b141863

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/bloomgateway/cache.go

+8
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func (m merger) MergeResponse(responses ...resultscache.Response) (resultscache.
113113

114114
type ClientCache struct {
115115
cache *resultscache.ResultsCache
116+
next logproto.BloomGatewayClient
116117
limits CacheLimits
117118
logger log.Logger
118119
}
@@ -149,12 +150,19 @@ func NewBloomGatewayClientCacheMiddleware(
149150
)
150151

151152
return &ClientCache{
153+
next: next,
152154
cache: resultsCache,
153155
limits: limits,
154156
logger: logger,
155157
}
156158
}
157159

160+
// PrefetchBloomBlocks implements logproto.BloomGatewayClient.
161+
func (c *ClientCache) PrefetchBloomBlocks(ctx context.Context, in *logproto.PrefetchBloomBlocksRequest, opts ...grpc.CallOption) (*logproto.PrefetchBloomBlocksResponse, error) {
162+
return c.next.PrefetchBloomBlocks(ctx, in, opts...)
163+
}
164+
165+
// FilterChunkRefs implements logproto.BloomGatewayClient.
158166
func (c *ClientCache) FilterChunkRefs(ctx context.Context, req *logproto.FilterChunkRefRequest, opts ...grpc.CallOption) (*logproto.FilterChunkRefResponse, error) {
159167
cacheReq := requestWithGrpcCallOptions{
160168
FilterChunkRefRequest: req,

pkg/bloomgateway/cache_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ type mockServer struct {
468468
res *logproto.FilterChunkRefResponse
469469
}
470470

471+
var _ logproto.BloomGatewayClient = &mockServer{}
472+
471473
func newMockServer(res *logproto.FilterChunkRefResponse) (*mockServer, *int) {
472474
var calls int
473475
return &mockServer{
@@ -480,11 +482,17 @@ func (s *mockServer) SetResponse(res *logproto.FilterChunkRefResponse) {
480482
s.res = res
481483
}
482484

485+
// FilterChunkRefs implements logproto.BloomGatewayClient.
483486
func (s *mockServer) FilterChunkRefs(_ context.Context, _ *logproto.FilterChunkRefRequest, _ ...grpc.CallOption) (*logproto.FilterChunkRefResponse, error) {
484487
*s.calls++
485488
return s.res, nil
486489
}
487490

491+
// PrefetchBloomBlocks implements logproto.BloomGatewayClient.
492+
func (s *mockServer) PrefetchBloomBlocks(_ context.Context, _ *logproto.PrefetchBloomBlocksRequest, _ ...grpc.CallOption) (*logproto.PrefetchBloomBlocksResponse, error) {
493+
panic("unimplemented")
494+
}
495+
488496
type mockLimits struct {
489497
cacheFreshness time.Duration
490498
cacheInterval time.Duration

0 commit comments

Comments
 (0)