Documentation
¶
Overview ¶
Package dcm implements DCM registration and heartbeat lifecycle management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNonRetryable = errors.New("non-retryable DCM error")
var ErrRateLimited = errors.New("dcm rate limited")
Functions ¶
Types ¶
type ConsumerLagProvider ¶
type ConsumerLagProvider interface {
ConsumerLag() int64
}
ConsumerLagProvider returns the current consumer lag for heartbeat payloads.
type RateLimitError ¶
RateLimitError is returned on HTTP 429 responses.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
func (*RateLimitError) Unwrap ¶
func (e *RateLimitError) Unwrap() error
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
Registrar handles DCM registration and heartbeat lifecycle.
func NewRegistrar ¶
func NewRegistrar( cfg RegistrarConfig, lister ServiceTypeLister, lagProvider ConsumerLagProvider, resourceProvider ResourceCapacityProvider, logger *slog.Logger, ) (*Registrar, error)
NewRegistrar creates a Registrar. Returns error if config is invalid.
func (*Registrar) AgentID ¶
AgentID returns the DCM-assigned agent ID, or ("", false) if not yet registered.
func (*Registrar) Done ¶
func (r *Registrar) Done() <-chan struct{}
Done returns a channel closed when the registrar goroutine exits.
func (*Registrar) NotifyServiceTypeChange ¶
func (r *Registrar) NotifyServiceTypeChange()
NotifyServiceTypeChange signals that the advertisable service types may have changed.
type RegistrarConfig ¶
type RegistrarConfig struct {
AgentName string
Environment string
Cost string
TopicName string
RegistrationURL string
InitialBackoff time.Duration
MaxBackoff time.Duration
HeartbeatInterval time.Duration
PrerequisiteRetryInterval time.Duration
}
RegistrarConfig holds the configuration for DCM registration.
type ResourceCapacityProvider ¶
type ResourceCapacityProvider interface {
ResourceCapacity() *v1alpha1.ResourceCapacity
}
ResourceCapacityProvider optionally returns resource availability for registration. Returns nil when not available (REQ-DCM-030 is SHOULD, not MUST).
type ServiceTypeLister ¶
type ServiceTypeLister interface {
AdvertisableServiceTypes() []string
}
ServiceTypeLister returns the set of currently advertisable service types (backed by SPs in Ready or Unhealthy state — NOT Unavailable).