Skip to content

Commit

Permalink
Add NewBlockOptions constructor (#10955)
Browse files Browse the repository at this point in the history
Adds a `NewBlockOptions()` constructor plus a quick fix for a missed err check.
  • Loading branch information
poyzannur authored Oct 19, 2023
1 parent 2abb472 commit cbc0df3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/storage/bloom/v1/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ type BlockBuilder struct {
blooms *BloomBlockBuilder
}

func NewBlockOptions() BlockOptions {
return BlockOptions{
schema: Schema{
version: byte(1),
},
SeriesPageSize: 100,
BloomPageSize: 10 << 10, // 0.01MB
}
}

func NewBlockBuilder(opts BlockOptions, writer BlockWriter) (*BlockBuilder, error) {
index, err := writer.Index()
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/storage/bloom/v1/index_querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func (it *LazySeriesIter) ensureInit() {
// Seek returns an iterator over the pages where the first fingerprint is >= fp
func (it *LazySeriesIter) Seek(fp model.Fingerprint) error {
it.ensureInit()
if it.err != nil {
return it.err
}

// first potentially relevant page
desiredPage := sort.Search(len(it.b.index.pageHeaders), func(i int) bool {
Expand Down

0 comments on commit cbc0df3

Please sign in to comment.