Skip to content

Rename chunk.ObjectClient and implement generic object store chunk client #2108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jtlisi
Copy link
Contributor

@jtlisi jtlisi commented Feb 10, 2020

What this PR does:

  • Rename the chunk ObjectClient to Client
  • Create a new ObjectClient interface with simple methods implemented in support for registering custom index clients, added new methods to object stores #2049
  • Create generic object store chunk client in pkg/chunk/object
  • Update fixtures to detect and utilize generic chunk object client during tests
  • Utilize the generic object.ChunkClient when S3/GCS/AzureBlobStore/LocalFS is specified as a chunk store, all of these backends already implement the ObjectClient interface.

Which issue(s) this PR fixes:
Fixes #2107

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@jtlisi jtlisi changed the title 20200210 rename chunk objectclient Rename chunk.ObjectClient and implement generic object store chunk client Feb 10, 2020
@@ -22,7 +23,7 @@ const (
// Fixture type for per-backend testing.
type Fixture interface {
Name() string
Clients() (chunk.IndexClient, chunk.ObjectClient, chunk.TableClient, chunk.SchemaConfig, error)
Clients() (chunk.IndexClient, chunk.Client, chunk.ObjectClient, chunk.TableClient, chunk.SchemaConfig, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having both chunk.Client and chunk.ObjectClient sounds redundant to me. Could you explain why we need chunk.ObjectClient too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can have the downstream fixtures wrap the object client before returning them

@jtlisi jtlisi force-pushed the 20200210_rename_chunk_objectclient branch 2 times, most recently from 5179c15 to 34315dd Compare February 13, 2020 18:22
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @jtlisi! I left few nits, but please consider it already approved 👏

@@ -155,7 +155,7 @@ func NewDynamoDBIndexClient(cfg DynamoDBConfig, schemaCfg chunk.SchemaConfig) (c
}

// NewDynamoDBObjectClient makes a new DynamoDB-backed ObjectClient.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjectClient > chunk.Client

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, I will also rename this function to be NewDynamoDBChunkClient

@@ -164,13 +165,12 @@ func NewIndexClient(name string, cfg Config, schemaCfg chunk.SchemaConfig) (chun
}

// NewObjectClient makes a new ObjectClient of the desired types.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjectClient > chunk.Client

@@ -164,13 +165,12 @@ func NewIndexClient(name string, cfg Config, schemaCfg chunk.SchemaConfig) (chun
}

// NewObjectClient makes a new ObjectClient of the desired types.
func NewObjectClient(name string, cfg Config, schemaCfg chunk.SchemaConfig) (chunk.ObjectClient, error) {
func NewObjectClient(name string, cfg Config, schemaCfg chunk.SchemaConfig) (chunk.Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit that now the function name NewObjectClient() is quite confusing, cause it returns chunk.Client and not chunk.ObjectClient. Given it's just called in this file, we may easily rename it to NewChunkClient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update it to reflect the changes.

…eneric ObjectClient chunk.Client

Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
@jtlisi jtlisi force-pushed the 20200210_rename_chunk_objectclient branch from f9238f9 to e48f0af Compare February 17, 2020 17:19
@jtlisi jtlisi merged commit b6a25a9 into cortexproject:master Feb 17, 2020
@jtlisi jtlisi deleted the 20200210_rename_chunk_objectclient branch February 17, 2020 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate ObjectClient interface
2 participants