Documentation ¶
Index ¶
- Variables
- func NewStore() *store.IndexStore
- type Config
- type Index
- func (i *Index) FindBlocks(tx *bbolt.Tx, list *metastorev1.BlockList) ([]*metastorev1.BlockMeta, error)
- func (i *Index) GetTenantStats(tenant string) *metastorev1.TenantStats
- func (i *Index) Init(tx *bbolt.Tx) error
- func (i *Index) InsertBlock(tx *bbolt.Tx, b *metastorev1.BlockMeta) error
- func (i *Index) QueryMetadata(tx *bbolt.Tx, query MetadataQuery) iter.Iterator[*metastorev1.BlockMeta]
- func (i *Index) ReplaceBlocks(tx *bbolt.Tx, compacted *metastorev1.CompactedBlocks) error
- func (i *Index) Restore(tx *bbolt.Tx) error
- type InvalidQueryError
- type MetadataQuery
- type Store
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{
PartitionDuration: partitionDuration,
QueryLookaroundPeriod: partitionDuration,
PartitionCacheSize: partitionTenantCacheSize,
}
var ErrBlockExists = fmt.Errorf("block already exists")
Functions ¶
func NewStore ¶ added in v1.11.0
func NewStore() *store.IndexStore
Types ¶
type Config ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func NewIndex ¶
NewIndex initializes a new metastore index.
The index provides access to block metadata. The data is partitioned by time, shard and tenant. Partition identifiers contain the time period referenced by partitions, e.g., "20240923T16.1h" refers to a partition for the 1-hour period between 2024-09-23T16:00:00.000Z and 2024-09-23T16:59:59.999Z.
Partitions are mostly transparent for the end user, though PartitionMeta is at times used externally. Partition durations are configurable (at application level).
The index requires a backing Store for loading data in memory. Data is loaded directly via LoadPartitions() or when looking up blocks with FindBlock() or FindBlocksInRange().
func (*Index) FindBlocks ¶ added in v1.11.0
func (i *Index) FindBlocks(tx *bbolt.Tx, list *metastorev1.BlockList) ([]*metastorev1.BlockMeta, error)
func (*Index) GetTenantStats ¶ added in v1.11.0
func (i *Index) GetTenantStats(tenant string) *metastorev1.TenantStats
func (*Index) InsertBlock ¶
func (*Index) QueryMetadata ¶ added in v1.11.0
func (i *Index) QueryMetadata(tx *bbolt.Tx, query MetadataQuery) iter.Iterator[*metastorev1.BlockMeta]
func (*Index) ReplaceBlocks ¶
func (i *Index) ReplaceBlocks(tx *bbolt.Tx, compacted *metastorev1.CompactedBlocks) error
ReplaceBlocks removes source blocks from the index and inserts replacement blocks into the index. The intended usage is for block compaction. The replacement blocks could be added to the same or a different partition.
type InvalidQueryError ¶ added in v1.11.0
type InvalidQueryError struct { Query MetadataQuery Err error }
func (*InvalidQueryError) Error ¶ added in v1.11.0
func (e *InvalidQueryError) Error() string
type MetadataQuery ¶ added in v1.11.0
func (*MetadataQuery) String ¶ added in v1.11.0
func (q *MetadataQuery) String() string
type Store ¶
type Store interface { CreateBuckets(*bbolt.Tx) error StoreBlock(tx *bbolt.Tx, shard *store.TenantShard, md *metastorev1.BlockMeta) error DeleteBlockList(*bbolt.Tx, store.PartitionKey, *metastorev1.BlockList) error ListPartitions(*bbolt.Tx) ([]*store.Partition, error) LoadTenantShard(*bbolt.Tx, store.PartitionKey, string, uint32) (*store.TenantShard, error) }