Documentation
¶
Overview ¶
Package pub implements the queue client.
Index ¶
- func New(metadata metadata.Repo, roles ...databasev1.Role) queue.Client
- func NewWithoutMetadata(omr observability.MetricsRegistry) queue.Client
- func ResolveResourceOptsForUpdate(l *logger.Logger, groupSchema *commonv1.Group, nodeLabels map[string]string) *commonv1.ResourceOpts
- func ResolveStageResourceOpts(ro *commonv1.ResourceOpts, nodeLabels map[string]string) (resolved *commonv1.ResourceOpts, matchedStage *commonv1.LifecycleStage, ...)
- type ChunkedSyncClientConfig
- type LabelSelector
- type MatchFunc
- type StageResolution
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a new queue client targeting the given node roles. If no roles are passed, it defaults to databasev1.Role_ROLE_DATA.
func NewWithoutMetadata ¶ added in v0.8.0
func NewWithoutMetadata(omr observability.MetricsRegistry) queue.Client
NewWithoutMetadata returns a new queue client without metadata, defaulting to data nodes. sender_* fields are left empty for this lifecycle-tool publisher.
If omr is non-nil, a parallel banyandb_lifecycle_migration_* metric family is registered on it. The regular banyandb_queue_pub_* family stays disabled because metadata is nil (PreRun gates it on metadata != nil). Pass nil to leave the migration metrics disabled (e.g. tests, or non-migration clients).
func ResolveResourceOptsForUpdate ¶ added in v0.11.0
func ResolveResourceOptsForUpdate(l *logger.Logger, groupSchema *commonv1.Group, nodeLabels map[string]string) *commonv1.ResourceOpts
ResolveResourceOptsForUpdate resolves the ResourceOpts a data node applies when a group is updated: the matched stage's interval/ttl/shardNum, or the group default when no stage applies. On a resolution error it keeps the group default rather than failing the update, and returns nil when the group carries no ResourceOpts. This is the shared body of every data supplier's ResolveResourceOpts.
func ResolveStageResourceOpts ¶ added in v0.11.0
func ResolveStageResourceOpts(ro *commonv1.ResourceOpts, nodeLabels map[string]string) ( resolved *commonv1.ResourceOpts, matchedStage *commonv1.LifecycleStage, matchedIdx int, err error, )
ResolveStageResourceOpts resolves the effective ResourceOpts for a data node whose lifecycle stage is selected by nodeLabels. It returns a deep clone of ro with SegmentInterval, Ttl (cumulative through the matched stage) and ShardNum overridden by the matched stage. matchedStage/matchedIdx identify the matched stage and are nil/-1 when no stage applies (the group has no stages, the node has no labels, or no stage selector matched the node's labels). The returned opts is always a fresh clone, so callers never mutate the shared group schema.
This is the single source of truth for the per-stage interval/ttl/shard resolution: both the initial OpenDB and any later UpdateOptions must go through it, otherwise a group update silently overwrites a stage node's interval/ttl with the group default.
Types ¶
type ChunkedSyncClientConfig ¶ added in v0.9.0
type ChunkedSyncClientConfig struct {
ChunkSize uint32 // Size of each chunk in bytes
EnableRetryOnOOO bool // Enable retry on out-of-order errors
MaxOOORetries int // Maximum retries for out-of-order chunks
OOORetryDelay time.Duration // Delay between retries
}
ChunkedSyncClientConfig configures chunked sync client behavior.
type LabelSelector ¶ added in v0.8.0
type LabelSelector struct {
// contains filtered or unexported fields
}
LabelSelector is a selector for labels.
func ParseLabelSelector ¶ added in v0.8.0
func ParseLabelSelector(selector string) (*LabelSelector, error)
ParseLabelSelector parses a label selector string.
type StageResolution ¶ added in v0.11.0
type StageResolution struct {
// ResourceOpts holds the effective SegmentInterval/Ttl/ShardNum -- the matched stage's
// values (cumulative ttl) or the group default. It is always a fresh clone.
ResourceOpts *commonv1.ResourceOpts
SegmentIdleTimeout time.Duration
// Matched reports whether the node matched a lifecycle stage (a warm/cold tier); the
// hot/initial tier and unlabeled nodes are not matched.
Matched bool
DisableRetention bool
DisableRotation bool
}
StageResolution is the fully-resolved storage configuration for a data node's tsdb, derived from the group ResourceOpts and the node's matched lifecycle stage. It carries everything OpenDB needs so the caller does no further stage logic.
Only ResourceOpts is re-applied on a group UpdateOptions; the rotation/retention fields are wired once at open time, so adding/removing/retiming a stage needs a node restart.
func ResolveStage ¶ added in v0.11.0
func ResolveStage(l *logger.Logger, groupName string, ro *commonv1.ResourceOpts, nodeLabels map[string]string) (StageResolution, error)
ResolveStage resolves the complete tsdb configuration for this node from the group opts and the node's lifecycle stage. It warns when a labeled node whose group has stages matches none of them and silently falls back to the group default -- the condition that previously produced short segments. This is the single entry point OpenDB uses.