Skip to content

Separate ObjectClient interface #2107

Closed
@jtlisi

Description

@jtlisi

This is a followup to a recent discussion that occurred in #2049.

Between S3/GCS/Azure/BoltDB, there is a lot of duplicated code between our chunk object stores. Specifically the GetChunks and PutChunks functions. After #2049, each of these backends supports the follow functions:

type ObjectClient interface {
  PutObject(ctx context.Context, objectKey string, object io.ReadSeeker) 
  GetObject(ctx context.Context, objectKey string) (io.ReadCloser, error)
  List(ctx context.Context, prefix string) ([]StorageObject, error)
}

For each of the Object backend stores, the current ObjectClient interface is implemented using the above functions.

As mentioned in the PR, I propose the following refactor:

  • Rename ObjectClient to Client without changing any functionality. Client is chosen as opposed to ChunkClient since the package name is chunk
  • Create a new ObjectClient interface that contains the the PutObject, GetObject and List functions
  • Create a generic implementation of the Client that would be built on top of the ObjectClient. This would allow a single Client to abstract differences between S3/GCS/AzureBS/BoltDB. It would also allow the ObjectClient to be used to store things other than chunks. DeletePlans or rule configs for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/productionIssues related to the production use of Cortex, inc. configuration, alerting and operating.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions