store

package
v0.0.100-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStringTable = errors.New("malformed string table")
	ErrInvalidShardIndex  = errors.New("malformed shard index")
)
View Source
var ErrInvalidPartitionKey = errors.New("invalid partition key")

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Partition   PartitionKey
	Shard       uint32
	Tenant      string
	BlockID     string
	BlockMeta   *metastorev1.BlockMeta
	StringTable *metadata.StringTable
}

type IndexStore

type IndexStore struct{}

func NewIndexStore

func NewIndexStore() *IndexStore

func (*IndexStore) CreateBuckets

func (m *IndexStore) CreateBuckets(tx *bbolt.Tx) error

func (*IndexStore) ListPartitions

func (m *IndexStore) ListPartitions(tx *bbolt.Tx) ([]*Partition, error)

func (*IndexStore) LoadShard added in v1.13.3

func (m *IndexStore) LoadShard(tx *bbolt.Tx, p PartitionKey, tenant string, shard uint32) (*Shard, error)

type Partition

type Partition struct {
	Key          PartitionKey
	TenantShards map[string]map[uint32]struct{}
}

func NewPartition

func NewPartition(k PartitionKey) *Partition

func (*Partition) AddTenantShard

func (p *Partition) AddTenantShard(tenant string, shard uint32)

func (*Partition) Compare

func (p *Partition) Compare(other *Partition) int

func (*Partition) EndTime

func (p *Partition) EndTime() time.Time

func (*Partition) HasIndexShard added in v1.13.3

func (p *Partition) HasIndexShard(tenant string, shard uint32) bool

func (*Partition) HasTenant

func (p *Partition) HasTenant(t string) bool

func (*Partition) Overlaps

func (p *Partition) Overlaps(start, end time.Time) bool

func (*Partition) StartTime

func (p *Partition) StartTime() time.Time

type PartitionKey

type PartitionKey struct {
	Timestamp time.Time
	Duration  time.Duration
}

func NewPartitionKey

func NewPartitionKey(timestamp time.Time, duration time.Duration) PartitionKey

func (PartitionKey) Bytes

func (k PartitionKey) Bytes() []byte

func (*PartitionKey) EndTime added in v1.13.3

func (k *PartitionKey) EndTime() time.Time

func (PartitionKey) Equal

func (k PartitionKey) Equal(x PartitionKey) bool

func (PartitionKey) MarshalBinary

func (k PartitionKey) MarshalBinary() ([]byte, error)

func (*PartitionKey) Overlaps added in v1.13.3

func (k *PartitionKey) Overlaps(start, end time.Time) bool

func (*PartitionKey) StartTime added in v1.13.3

func (k *PartitionKey) StartTime() time.Time

func (PartitionKey) String

func (k PartitionKey) String() string

func (*PartitionKey) UnmarshalBinary

func (k *PartitionKey) UnmarshalBinary(b []byte) error

type Shard added in v1.13.3

type Shard struct {
	Partition PartitionKey
	Tenant    string
	Shard     uint32
	*metadata.StringTable
	ShardIndex
}

func (*Shard) Blocks added in v1.13.3

func (s *Shard) Blocks(tx *bbolt.Tx) *store.CursorIterator

func (*Shard) Delete added in v1.13.3

func (s *Shard) Delete(tx *bbolt.Tx, blocks ...string) error

func (*Shard) Find added in v1.13.3

func (s *Shard) Find(tx *bbolt.Tx, blocks ...string) []store.KV

func (*Shard) Overlaps added in v1.13.3

func (s *Shard) Overlaps(start, end time.Time) bool

func (*Shard) ShallowCopy added in v1.13.3

func (s *Shard) ShallowCopy() *Shard

ShallowCopy creates a shallow copy: no deep copy of the string table. The copy can be accessed safely by multiple readers, and it represents a snapshot of the string table at the time of the copy.

Strings added after the copy is made won't be visible to the reader. The writer MUST invalidate the cache before access: copies in-use can still be used (strings is a header copy of append-only slice).

func (*Shard) Store added in v1.13.3

func (s *Shard) Store(tx *bbolt.Tx, md *metastorev1.BlockMeta) error

type ShardIndex added in v1.13.3

type ShardIndex struct {
	MinTime int64
	MaxTime int64
}

func (*ShardIndex) MarshalBinary added in v1.13.3

func (i *ShardIndex) MarshalBinary() []byte

func (*ShardIndex) UnmarshalBinary added in v1.13.3

func (i *ShardIndex) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL