Documentation
¶
Overview ¶
Package wqueue provides a write queue implementation for managing data shards.
Index ¶
- Variables
- type Metrics
- type Opts
- type Queue
- func (q *Queue[S, O]) Close() error
- func (q *Queue[S, O]) GetNodes(shardID common.ShardID) []string
- func (q *Queue[S, O]) GetOrCreateShard(shardID common.ShardID) (*Shard[S], error)
- func (q *Queue[S, O]) GetTimeRange(ts time.Time) timestamp.TimeRange
- func (q *Queue[S, O]) UpdateOptions(resourceOpts *commonv1.ResourceOpts)
- type Shard
- type SubQueue
- type SubQueueCreator
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownShard = errors.New("unknown shard")
ErrUnknownShard indicates that the shard is not found.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics interface {
// DeleteAll deletes all metrics.
DeleteAll()
}
Metrics is the interface of metrics.
type Opts ¶
type Opts[S SubQueue, O any] struct { SubQueueCreator SubQueueCreator[S, O] GetNodes func(common.ShardID) []string Metrics Metrics Option O Group string Location string SegmentInterval storage.IntervalRule ShardNum uint32 }
Opts contains configuration options for creating a queue.
type Queue ¶
Queue represents a write queue that manages multiple shards.
func (*Queue[S, O]) GetOrCreateShard ¶
GetOrCreateShard gets or creates a shard with the given ShardID. If the shard already exists, it returns it without locking. If the shard doesn't exist, it creates a new one with proper locking.
func (*Queue[S, O]) GetTimeRange ¶
GetTimeRange returns a valid time range based on an input timestamp. It uses the Queue's SegmentInterval to generate the time range.
func (*Queue[S, O]) UpdateOptions ¶
func (q *Queue[S, O]) UpdateOptions(resourceOpts *commonv1.ResourceOpts)
UpdateOptions updates the queue options with new resource options.
type Shard ¶
type Shard[S SubQueue] struct { // contains filtered or unexported fields }
Shard represents a data shard containing a sub-queue and associated metadata.
type SubQueueCreator ¶
type SubQueueCreator[S SubQueue, O any] func(fileSystem fs.FileSystem, root string, position common.Position, l *logger.Logger, option O, metrics any, group string, shardID common.ShardID, getNodes func() []string) (S, error)
SubQueueCreator is a function type that creates a sub-queue with the given parameters.