github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/storage/stores/series/index/index_reader.go (about) 1 package index 2 3 import ( 4 "context" 5 ) 6 7 // EntryProcessor receives index entries from a table. 8 type EntryProcessor interface { 9 ProcessIndexEntry(indexEntry Entry) error 10 11 // Will this user be accepted by the processor? 12 AcceptUser(user string) bool 13 14 // Called at the end of reading of index entries. 15 Flush() error 16 } 17 18 // Reader parses index entries and passes them to the IndexEntryProcessor. 19 type Reader interface { 20 IndexTableNames(ctx context.Context) ([]string, error) 21 22 // Reads a single table from index, and passes individual index entries to the processors. 23 // 24 // All entries with the same TableName, HashValue and RangeValue are passed to the same processor, 25 // and all such entries (with different Values) are passed before index entries with different 26 // values of HashValue and RangeValue are passed to the same processor. 27 // 28 // This allows IndexEntryProcessor to find when values for given Hash and Range finish: 29 // as soon as new Hash and Range differ from last IndexEntry. 30 // 31 // Index entries passed to the same processor arrive sorted by HashValue and RangeValue. 32 ReadIndexEntries(ctx context.Context, table string, processors []EntryProcessor) error 33 }