Skip to content

Commit

Permalink
rename field from Postings to DecodePostings
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 committed Apr 13, 2024
1 parent f71cf6e commit fbc5edc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions tsdb/index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ func newReader(b ByteSlice, c io.Closer, postingsDecoder PostingsDecoder) (*Read
if postingsDecoder == nil {
postingsDecoder = DecodePostingsRaw
}
r.dec = &Decoder{LookupSymbol: r.lookupSymbol, Postings: postingsDecoder}
r.dec = &Decoder{LookupSymbol: r.lookupSymbol, DecodePostings: postingsDecoder}

return r, nil
}
Expand Down Expand Up @@ -1679,7 +1679,7 @@ func (r *Reader) Postings(ctx context.Context, name string, values ...string) (P
}
// Read from the postings table.
d := encoding.NewDecbufAt(r.b, int(postingsOff), castagnoliTable)
_, p, err := r.dec.Postings(d.Get())
_, p, err := r.dec.DecodePostings(d.Get())
if err != nil {
return nil, fmt.Errorf("decode postings: %w", err)
}
Expand Down Expand Up @@ -1741,7 +1741,7 @@ func (r *Reader) Postings(ctx context.Context, name string, values ...string) (P
if string(v) == value {
// Read from the postings table.
d2 := encoding.NewDecbufAt(r.b, int(postingsOff), castagnoliTable)
_, p, err := r.dec.Postings(d2.Get())
_, p, err := r.dec.DecodePostings(d2.Get())
if err != nil {
return nil, fmt.Errorf("decode postings: %w", err)
}
Expand Down Expand Up @@ -1853,8 +1853,8 @@ func (s stringListIter) Err() error { return nil }
// It currently does not contain decoding methods for all entry types but can be extended
// by them if there's demand.
type Decoder struct {
LookupSymbol func(context.Context, uint32) (string, error)
Postings PostingsDecoder
LookupSymbol func(context.Context, uint32) (string, error)
DecodePostings PostingsDecoder
}

// DecodePostingsRaw returns a postings list for b and its number of elements.
Expand Down
2 changes: 1 addition & 1 deletion tsdb/index/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func BenchmarkReader_ShardedPostings(b *testing.B) {
}

func TestDecoder_Postings_WrongInput(t *testing.T) {
_, _, err := (&Decoder{Postings: DecodePostingsRaw}).Postings([]byte("the cake is a lie"))
_, _, err := (&Decoder{DecodePostings: DecodePostingsRaw}).DecodePostings([]byte("the cake is a lie"))
require.Error(t, err)
}

Expand Down

0 comments on commit fbc5edc

Please sign in to comment.