github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/storage/chunk/client/client.go (about)

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