forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
30 lines (25 loc) · 998 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package client
import (
"context"
"errors"
"github.com/grafana/loki/pkg/storage/chunk"
"github.com/grafana/loki/pkg/storage/stores/series/index"
)
var (
// ErrMethodNotImplemented when any of the storage clients do not implement a method
ErrMethodNotImplemented = errors.New("method is not implemented")
// ErrStorageObjectNotFound when object storage does not have requested object
ErrStorageObjectNotFound = errors.New("object not found in storage")
)
// Client is for storing and retrieving chunks.
type Client interface {
Stop()
PutChunks(ctx context.Context, chunks []chunk.Chunk) error
GetChunks(ctx context.Context, chunks []chunk.Chunk) ([]chunk.Chunk, error)
DeleteChunk(ctx context.Context, userID, chunkID string) error
IsChunkNotFoundErr(err error) bool
}
// ObjectAndIndexClient allows optimisations where the same client handles both
type ObjectAndIndexClient interface {
PutChunksAndIndex(ctx context.Context, chunks []chunk.Chunk, index index.WriteBatch) error
}