...

Package monitor

import "github.com/LINBIT/golinstor/monitor"
Overview
Index

Overview ▾

Constants

const (
    INITIAL_DELAY_DEFAULT  = 1 * time.Minute
    EXISTING_DELAY_DEFAULT = 45 * time.Second
)

type LostResourceUser

LostResourceUser is a struct that exposes the "may promote" state of a DRBD resource If a resource may be promoted (i.e., may be switched to Primary) after some grace period, this usually means that its user (that had the resource promoted) failed. It could also happen that the user just terminated/gets rescheduled,... It is up to the user of this API to decide. This also means that the user (e.g., some k8s pod) needs to be restarted/rescheduled. The LostResourceUser is generic, it sends the names of resources that lost their user on the channel C.

type LostResourceUser struct {
    C chan string // DRBD resource names of resources that may be promoted.
    // contains filtered or unexported fields
}

func NewLostResourceUser

func NewLostResourceUser(ctx context.Context, client *client.Client, options ...Option) (*LostResourceUser, error)

NewLostResourceUser creates a new LostResourceUser. It takes a context, a Go LINSTOR client, and options as its input.

func (*LostResourceUser) Stop

func (rl *LostResourceUser) Stop()

Stop terminates all helper Go routines and closes the connection to the events stream.

type Option

Option represents a configuration option of the LostResourceUser

type Option func(*LostResourceUser) error

func WithDelay

func WithDelay(initial, existing time.Duration) Option

WithDelay sets the "initial delay" (for not yet seen resources) and the "existing delay" (for already known resources).