diff --git a/src/cmd/tools/query_index_segments/main/main.go b/src/cmd/tools/query_index_segments/main/main.go index 33aa738419..dcd540b0b8 100644 --- a/src/cmd/tools/query_index_segments/main/main.go +++ b/src/cmd/tools/query_index_segments/main/main.go @@ -194,7 +194,7 @@ func run(opts runOptions) { fields := make(map[string]string) for iter.Next() { d := iter.Current() - m, err := docs.GetFromDocument(d, reader) + m, err := docs.MetadataFromDocument(d, reader) if err != nil { log.Fatal("error retrieve document metadata", zap.Error(err)) } diff --git a/src/dbnode/network/server/tchannelthrift/node/service.go b/src/dbnode/network/server/tchannelthrift/node/service.go index 753015ec4a..5b1904cf2d 100644 --- a/src/dbnode/network/server/tchannelthrift/node/service.go +++ b/src/dbnode/network/server/tchannelthrift/node/service.go @@ -520,7 +520,7 @@ func (s *service) query(ctx context.Context, db storage.Database, req *rpc.Query id := ident.NewReusableBytesID() for _, entry := range queryResult.Results.Map().Iter() { d := entry.Value() - metadata, err := docs.GetFromDocument(d, reader) + metadata, err := docs.MetadataFromDocument(d, reader) if err != nil { return nil, err } @@ -814,7 +814,7 @@ func (s *service) fetchReadEncoded(ctx context.Context, tsID := id d := entry.Value() - metadata, err := docs.GetFromDocument(d, reader) + metadata, err := docs.MetadataFromDocument(d, reader) if err != nil { return err } diff --git a/src/dbnode/storage/index/aggregate_results.go b/src/dbnode/storage/index/aggregate_results.go index de709de96e..b2bd4ea908 100644 --- a/src/dbnode/storage/index/aggregate_results.go +++ b/src/dbnode/storage/index/aggregate_results.go @@ -198,7 +198,7 @@ func (r *aggregatedResults) addDocumentsBatchWithLock( func (r *aggregatedResults) addDocumentTermsWithLock( container doc.Document, ) error { - document, err := docs.GetFromDocument(container, &r.encodedDocReader) + document, err := docs.MetadataFromDocument(container, &r.encodedDocReader) if err != nil { return fmt.Errorf("unable to decode encoded document; %w", err) } @@ -242,7 +242,7 @@ func (r *aggregatedResults) addTermWithLock( func (r *aggregatedResults) addDocumentWithLock( container doc.Document, ) error { - document, err := docs.GetFromDocument(container, &r.encodedDocReader) + document, err := docs.MetadataFromDocument(container, &r.encodedDocReader) if err != nil { return fmt.Errorf("unable to decode encoded document; %w", err) } diff --git a/src/dbnode/storage/index/results_test.go b/src/dbnode/storage/index/results_test.go index 7fcd350559..864a8bf50f 100644 --- a/src/dbnode/storage/index/results_test.go +++ b/src/dbnode/storage/index/results_test.go @@ -203,7 +203,7 @@ func TestResultsInsertDoesNotCopy(t *testing.T) { // Ensure the underlying []byte for ID/Fields is the same. require.True(t, xtest.ByteSlicesBackedBySameData(key, dValid.ID)) d := entry.Value() - m, err := docs.GetFromDocument(d, reader) + m, err := docs.MetadataFromDocument(d, reader) require.NoError(t, err) tags := idxconvert.ToSeriesTags(m, idxconvert.Opts{NoClone: true}) diff --git a/src/dbnode/storage/index/wide_query_results_test.go b/src/dbnode/storage/index/wide_query_results_test.go index 04539ddfed..4160f32414 100644 --- a/src/dbnode/storage/index/wide_query_results_test.go +++ b/src/dbnode/storage/index/wide_query_results_test.go @@ -81,7 +81,7 @@ func buildExpected(t *testing.T, docs [][]doc.Document) [][]string { for _, batch := range docs { idBatch := make([]string, 0, len(batch)) for _, document := range batch { // nolint:gocritic - m, err := encoding.GetFromDocument(document, reader) + m, err := encoding.MetadataFromDocument(document, reader) require.NoError(t, err) idBatch = append(idBatch, string(m.ID)) } diff --git a/src/dbnode/storage/index_queue_forward_write_test.go b/src/dbnode/storage/index_queue_forward_write_test.go index 265b5ac7fe..7099951c36 100644 --- a/src/dbnode/storage/index_queue_forward_write_test.go +++ b/src/dbnode/storage/index_queue_forward_write_test.go @@ -158,7 +158,7 @@ func TestNamespaceForwardIndexInsertQuery(t *testing.T) { require.Equal(t, "testns1", results.Namespace().String()) d, ok := results.Map().Get(ident.BytesID("foo")) - md, err := docs.GetFromDocument(d, reader) + md, err := docs.MetadataFromDocument(d, reader) require.NoError(t, err) tags := idxconvert.ToSeriesTags(md, idxconvert.Opts{NoClone: true}) diff --git a/src/dbnode/storage/index_queue_test.go b/src/dbnode/storage/index_queue_test.go index 833b8d7fc1..14fbc09d5c 100644 --- a/src/dbnode/storage/index_queue_test.go +++ b/src/dbnode/storage/index_queue_test.go @@ -351,7 +351,7 @@ func TestNamespaceIndexInsertQuery(t *testing.T) { reader := docs.NewEncodedDocumentReader() d, ok := results.Map().Get(ident.BytesID("foo")) - md, err := docs.GetFromDocument(d, reader) + md, err := docs.MetadataFromDocument(d, reader) require.NoError(t, err) tags := idxconvert.ToSeriesTags(md, idxconvert.Opts{NoClone: true}) diff --git a/src/dbnode/test/util.go b/src/dbnode/test/util.go index 7282cd0a82..034c6d82f8 100644 --- a/src/dbnode/test/util.go +++ b/src/dbnode/test/util.go @@ -36,7 +36,7 @@ import ( // ident.TagIterator. func DocumentToTagIter(t *testing.T, doc doc.Document) ident.TagIterator { reader := docs.NewEncodedDocumentReader() - m, err := docs.GetFromDocument(doc, reader) + m, err := docs.MetadataFromDocument(doc, reader) require.NoError(t, err) return convert.ToSeriesTags(m, convert.Opts{NoClone: true}) diff --git a/src/m3ninx/index/segment/fst/encoding/docs/data.go b/src/m3ninx/index/segment/fst/encoding/docs/data.go index 00092152b3..aa2d44fd59 100644 --- a/src/m3ninx/index/segment/fst/encoding/docs/data.go +++ b/src/m3ninx/index/segment/fst/encoding/docs/data.go @@ -213,8 +213,8 @@ func ReadEncodedDocumentID(encoded doc.Encoded) ([]byte, error) { return id, err } -// GetFromDocument retrieves a doc.Metadata from a doc.Document. -func GetFromDocument(document doc.Document, reader *EncodedDocumentReader) (doc.Metadata, error) { +// MetadataFromDocument retrieves a doc.Metadata from a doc.Document. +func MetadataFromDocument(document doc.Document, reader *EncodedDocumentReader) (doc.Metadata, error) { if d, ok := document.Metadata(); ok { return d, nil } diff --git a/src/m3ninx/search/proptest/util.go b/src/m3ninx/search/proptest/util.go index 2f1b96bbf2..58a25fa873 100644 --- a/src/m3ninx/search/proptest/util.go +++ b/src/m3ninx/search/proptest/util.go @@ -86,10 +86,10 @@ func (m *documentIteratorMatcher) Matches(i doc.Iterator) error { func (m *documentIteratorMatcher) compareDocs(d1 doc.Document, d2 doc.Document) bool { docReader := idxdocs.NewEncodedDocumentReader() - d1Metadata, err := idxdocs.GetFromDocument(d1, docReader) + d1Metadata, err := idxdocs.MetadataFromDocument(d1, docReader) require.NoError(m.t, err) - d2Metadata, err := idxdocs.GetFromDocument(d2, docReader) + d2Metadata, err := idxdocs.MetadataFromDocument(d2, docReader) require.NoError(m.t, err) return d1Metadata.Equal(d2Metadata)