Skip to content

Commit

Permalink
Review fix: rename new bucket store constructor; deprecated the old one
Browse files Browse the repository at this point in the history
Signed-off-by: Max Neverov <[email protected]>
  • Loading branch information
mneverov committed Sep 30, 2020
1 parent 92a8ab6 commit ae47944
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/thanos/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func runStore(
store.WithChunksSizeLimit(store.NewChunksLimiterFactory(maxSampleSize)),
}

bs, err := store.New(
bs, err := store.NewBucketStoreWithOptions(
logger,
reg,
bkt,
Expand Down
7 changes: 4 additions & 3 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ var defaultBucketStoreOptions = bucketStoreOptions{
chunksSizeLimitFactory: NewChunksLimiterFactory(noChunksSizeLimit),
}

// Deprecated. Use NewBucketStoreWithOptions instead.
// NewBucketStore creates a new bucket backed store that implements the store API against
// an object store bucket. It is optimized to work against high latency backends.
func NewBucketStore(
Expand All @@ -350,7 +351,7 @@ func NewBucketStore(
WithChunksLimit(chunksLimiterFactory),
WithChunksSizeLimit(NewChunksLimiterFactory(noChunksSizeLimit)),
}
return New(logger,
return NewBucketStoreWithOptions(logger,
reg,
bkt,
fetcher,
Expand All @@ -369,9 +370,9 @@ func NewBucketStore(
)
}

// New creates a new bucket backed store that implements the store API against
// NewBucketStoreWithOptions creates a new bucket backed store that implements the store API against
// an object store bucket. It is optimized to work against high latency backends.
func New(
func NewBucketStoreWithOptions(
logger log.Logger,
reg prometheus.Registerer,
bkt objstore.InstrumentedBucketReader,
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/bucket_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func prepareStoreWithTestBlocks(t testing.TB, dir string, bkt objstore.Bucket, m
}, nil)
testutil.Ok(t, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
s.logger,
nil,
objstore.WithNoopInstr(bkt),
Expand Down
12 changes: 6 additions & 6 deletions pkg/store/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ func TestBucketStore_Info(t *testing.T) {

defer testutil.Ok(t, os.RemoveAll(dir))

bucketStore, err := New(
bucketStore, err := NewBucketStoreWithOptions(
nil,
nil,
nil,
Expand Down Expand Up @@ -598,7 +598,7 @@ func TestSeries_ErrorInvalidLimiter(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
dir := t.TempDir()
store, err := New(
store, err := NewBucketStoreWithOptions(
nil,
nil,
nil,
Expand Down Expand Up @@ -855,7 +855,7 @@ func testSharding(t *testing.T, reuseDisk string, bkt objstore.Bucket, all ...ul
}, nil)
testutil.Ok(t, err)

bucketStore, err := New(
bucketStore, err := NewBucketStoreWithOptions(
logger,
nil,
objstore.WithNoopInstr(rec),
Expand Down Expand Up @@ -1610,7 +1610,7 @@ func TestSeries_RequestAndResponseHints(t *testing.T) {
indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(logger, nil, storecache.InMemoryIndexCacheConfig{})
testutil.Ok(tb, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
logger,
nil,
instrBkt,
Expand Down Expand Up @@ -1719,7 +1719,7 @@ func TestSeries_ErrorUnmarshallingRequestHints(t *testing.T) {
indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(logger, nil, storecache.InMemoryIndexCacheConfig{})
testutil.Ok(tb, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
logger,
nil,
instrBkt,
Expand Down Expand Up @@ -1822,7 +1822,7 @@ func TestBlockWithLargeChunks(t *testing.T) {
indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(logger, nil, storecache.InMemoryIndexCacheConfig{})
testutil.Ok(t, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
logger,
nil,
instrBkt,
Expand Down

0 comments on commit ae47944

Please sign in to comment.