resource

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 47 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	HoldMountPoint    = "mount point"
	HoldBlockDevice   = "block device"
	HoldVG            = "volume group"
	HoldLV            = "logical volume"
	HoldZpool         = "zpool"
	HoldZfsDataset    = "zfs dataset"
	HoldMD            = "md"
	HoldFile          = "file"
	HoldDMName        = "device mapper name"
	HoldDRBD          = "drbd resource"
	HoldRadosImage    = "rados image"
	HoldDiskID        = "disk id"
	HoldContainerName = "container name"
	HoldIPAddress     = "ip address"
	HoldExport        = "export"
	HoldVolume        = "volume"
	HoldSharedVolume  = "shared volume"
)

The classes of the values resources hold.

View Source
const (
	// IPAddrInfoKey is the status info a resource publishes its address
	// under, the dns and the ipam reading it there.
	IPAddrInfoKey = "ipaddr"

	// IPAddrsInfoKey is the status info a resource holding several addresses
	// publishes them all under, IPAddrInfoKey holding the first: the guest of
	// a container on several networks, one per family at least.
	IPAddrsInfoKey = "ipaddrs"
)

Variables

View Source
var (
	ErrActionNotSupported      = errors.New("the resource action is not supported on resource")
	ErrActionPostponedToLinker = errors.New("the resource action is postponed to its linker")
	ErrDisabled                = errors.New("the resource is disabled")
	ErrActionReqNotMet         = errors.New("the resource action requirements are not met")
	ErrBarrier                 = errors.New("barrier hit")
)

Functions

func Action

func Action(ctx context.Context, r Driver) error

Action calls the resource method set as the RES_ACTION environment variable

func Boot

func Boot(ctx context.Context, r Driver) error

Boot deactivates a resource when the node is rebooted

func DevicePaths

func DevicePaths(s string) []string

DevicePaths returns the block device paths of s, a list of words: the ones naming a device under /dev, not a pattern of them, cleaned.

func EvalStatus

func EvalStatus(ctx context.Context, r Driver) status.T

EvalStatus evaluates the status of a resource interfacer

func Full

func Full(ctx context.Context, r Driver) error

Full execute the resource Update function, if implemented by the driver.

func HandsOutWhatIsBelow

func HandsOutWhatIsBelow(below int64) int64

HandsOutWhatIsBelow is what a ResizeHandsOuter hands out when it hands out what is below it, a filesystem counting as its device.

func ImportDevices

func ImportDevices(ctx context.Context, r Driver) error

ImportDevices execute the Driver ImportDevices() function if defined. Some drivers need to import devices before they can list the reservable devices to register. So use this in the start codepath.

func Ingest

func Ingest(ctx context.Context, r Driver) error

Ingest execute the resource Ingest function, if implemented by the driver.

func IsSelected

func IsSelected(ctx context.Context, r Driver) (selected, known bool)

IsSelected tells whether the resource r is among the resources the running action recorded with actioncontext.WithSelectedRIDs, i.e. the ones it works on or reads the state of. The known return value is false when no selection is recorded for the object of r, so the caller can apply its default policy.

func IsStopped

func IsStopped(r varDirer) (bool, error)

func NewResourceFunc

func NewResourceFunc(drvID driver.ID) func() Driver

func PGReset

func PGReset(ctx context.Context, r Driver) error

PGReset lifts the capping of the process group of a resource.

func PGUpdate

func PGUpdate(ctx context.Context, r Driver) error

func PRStart

func PRStart(ctx context.Context, r Driver) error

PRStart activates a resource interfacer S3GPR

func PRStop

func PRStop(ctx context.Context, r Driver) error

PRStop deactivates a resource interfacer S3GPR

func Provision

func Provision(ctx context.Context, r Driver, leader bool) error

Provision handles triggers around provision() and resource dependencies

func ProvisionCreates

func ProvisionCreates(ctx context.Context) bool

ProvisionCreates says whether the provision of the resource creates what it names, as WithProvisionCreates set it.

func ProvisionRecorded

func ProvisionRecorded(r Driver) bool

ProvisionRecorded says whether a provision made the resource on this node, or a sysadmin declared it with a provision --state-only: what it holds is its own, and not something else's a provision would adopt.

func Provisioned

func Provisioned(ctx context.Context, t Driver) (provisioned.T, error)

func RecordedProvisioned

func RecordedProvisioned(r Driver) bool

RecordedProvisioned says the provisioned state of the resource is recorded, and true: the resource holds something on the node.

func Restore

func Restore(ctx context.Context, r Driver) error

Restore executes the resource Restore function, if implemented by the driver: the data of a sync resource written back from a snapshot.

func Resync

func Resync(ctx context.Context, r Driver) error

Resync execute the resource Resync function, if implemented by the driver.

func Run

func Run(ctx context.Context, r Driver) error

Run calls Run() if the resource is a Runner

func SCSIPersistentReservationStart

func SCSIPersistentReservationStart(ctx context.Context, r Driver) error

func SCSIPersistentReservationStatus

func SCSIPersistentReservationStatus(ctx context.Context, r Driver, coresourceStatus status.T) status.T

func SCSIPersistentReservationStop

func SCSIPersistentReservationStop(ctx context.Context, r Driver) error

func SetProvisioned

func SetProvisioned(ctx context.Context, r Driver) error

SetProvisioned creates a flag file in the resource var dir to remember that the provision is done.

func SetProvisionedFound

func SetProvisionedFound(ctx context.Context, r Driver) error

SetProvisionedFound records the resource provisioned because its status found it up, which does not tell a provision made it: a filesystem mounted on its mount point by something else is found up. The provision of the resource is not recorded, so a provision checks what it holds.

func SetProvisionedFoundSince

func SetProvisionedFoundSince(ctx context.Context, r Driver, before ProvisionedFlag) (bool, error)

SetProvisionedFoundSince records the resource provisioned, found up by a status evaluation, when its flag was false before the evaluation began and is still the same, and says whether it did.

The evaluation reads the status of the resource first, and its flag last, with no lock an action takes: an unprovision removing the resource and writing false between the two left a status read up, and a flag read false, which the evaluation turned back to true. The resource, removed, stayed provisioned, and the unprovision orchestration waited for ever. A flag true before the evaluation, or rewritten during it, is no flag the evaluation may answer for.

func SetUnprovisioned

func SetUnprovisioned(ctx context.Context, r Driver) error

SetUnprovisioned removes the flag file in the resource var dir to forget that the provision is done.

func Setenv

func Setenv(r Driver)

func Shutdown

func Shutdown(ctx context.Context, r Driver) error

Shutdown deactivates a resource even if standby is true

func Split

func Split(ctx context.Context, r Driver) error

Split execute the resource Split function, if implemented by the driver.

func Start

func Start(ctx context.Context, r Driver) error

Start activates a resource interfacer

func StartStandby

func StartStandby(ctx context.Context, r Driver) error

StartStandby activates a resource interfacer

func StatusCheckRequires

func StatusCheckRequires(ctx context.Context, action string, r requirer) error

func StatusDependsOnPeers

func StatusDependsOnPeers(r Driver) bool

StatusDependsOnPeers tells whether the status of r reads a state the actions of the peer instances change, for the daemon to evaluate it again when a peer instance changes.

A resource with a SCSI persistent reservation does, whatever its driver: a peer starting or stopping takes or drops the reservation its status reports the holder of.

func Stop

func Stop(ctx context.Context, r Driver) error

Stop deactivates a resource

func Unprovision

func Unprovision(ctx context.Context, r Driver, leader bool) error

Unprovision handles triggers around unprovision() and resource dependencies

func Unstop

func Unstop(ctx context.Context, r Driver) error

Unstop lowers the flag a stop of the resource alone raised, which keeps the daemon from restarting it, and starts nothing.

func Update

func Update(ctx context.Context, r Driver) error

Update execute the resource Update function, if implemented by the driver.

func WithProvisionCreates

func WithProvisionCreates(ctx context.Context, v bool) context.Context

WithProvisionCreates says, to the preflight of a resource, whether its configuration sets a keyword used only to provision it, as a template or a virt-install command: its provision creates what it names, and what exists of that name is not its own. A resource setting none takes over what exists, as a virtual machine defined by a sysadmin it is configured on.

Types

type Aborter

type Aborter interface {
	Abort(ctx context.Context) bool
}

Aborter implements the Abort func, which can return true to block a start action before any resource has entered Start().

type ActionResourceDepser

type ActionResourceDepser interface {
	ActionResourceDeps() []actionresdeps.Dep
}

ActionResourceDepser implements the ActionResourceDeps func, which return a list of {action, rid depending on, rid depended on} tuples.

type Commander

type Commander interface {
	CombinedOutput() ([]byte, error)
	Run() error
	Start() error
	StderrPipe() (io.ReadCloser, error)
	Wait() error
}

type ConfigErrorer

type ConfigErrorer interface {
	ConfigError(ctx context.Context) error
}

ConfigErrorer is a resource able to say its configuration is wrong while it holds nothing on the node: its start refuses that configuration before it sets anything up, and nothing a former start set up is found. Its status is undef, and the error is its ConfigError, which tells the change of that configuration is not one a resource up would leak by. A resource holding something, or not able to tell, returns nil, and its status says the error.

type ConfigRestorer

type ConfigRestorer interface {
	// RestoredConfig returns the configuration of the snapshot the
	// restore options of the context name, as the object restores
	// it, and the keywords it changes, none when it is the
	// configuration of the object already.
	RestoredConfig(context.Context) ([]byte, []string, error)
}

ConfigRestorer is a sync resource holding the configuration of the object at the points in time it can restore.

type Configurer

type Configurer interface {
	Configure() error
}

Configurer is an optional interface resource drivers can implement if they want to configure the resource after the manifest data has been loaded. For example, tuning the logger.

type Driver

type Driver interface {
	Provisioned(context.Context) (provisioned.T, error)

	// common
	ApplyPG(context.Context) error
	ResetPG(context.Context) error
	DriverID() driver.ID
	GetObject() any
	GetPG() *pg.Config
	GetPGID() string
	ID() *resourceid.T
	IsActionDisabled() bool
	IsDisabled() bool
	IsEncap() bool
	IsMonitored() bool
	IsOptional() bool
	IsProvisionDisabled() bool
	IsUnprovisionDisabled() bool
	IsShared() bool
	IsStandby() bool
	IsStopped() bool
	IsStatusDisabled() bool

	GetConfigurationError() error
	SetConfigurationError(error)

	// Label returns a formatted short description of the Resource
	Label(context.Context) string

	Log() *plog.Logger
	Manifest() *manifest.T
	MatchRID(string) bool
	MatchSubset(string) bool
	MatchTag(string) bool
	Requires(string) *resourcereqs.T
	RID() string
	RSubset() string
	SetDisabled(v bool)
	SetObject(any)
	SetPG(*pg.Config)
	SetRID(string) error
	Status(context.Context) status.T
	StatusLog() StatusLogger
	TagSet() TagSet
	Trigger(context.Context, trigger.Blocking, trigger.Hook, trigger.Action) error
	VarDir() string
}

Driver exposes what can be done with a resource

type Drivers

type Drivers []Driver

func (Drivers) Add

func (t Drivers) Add(r Driver) Drivers

func (Drivers) Barrier

func (t Drivers) Barrier(s string) string

Barrier returns the rid of the resource that the instance action must stop at (included).

Example:

  1. ip#1
  2. ip#2 link to container#2
  3. ip#3
  4. container#1
  5. container#2
  6. container#3

Barrier("ip#2") returns ip#2 Barrier("ip") returns ip#2 [idx=4]

As a consequence the startup sequence is:

ip#1
ip#3
container#1
container#2
ip#2

func (Drivers) GetRID

func (t Drivers) GetRID(rid string) Driver

func (Drivers) Has

func (t Drivers) Has(d Driver) bool

Has returns true if t has a driver whose RID() is the same as d.

func (Drivers) HasRID

func (t Drivers) HasRID(rid string) bool

HasRID returns true if t has a driver whose RID() is the same as rid.

func (Drivers) Index

func (t Drivers) Index(rid string) int

func (Drivers) Intersection

func (t Drivers) Intersection(other Drivers) Drivers

Intersection returns a list of drivers ordered like t and purged from drivers in other.

func (Drivers) Len

func (t Drivers) Len() int

func (Drivers) Less

func (t Drivers) Less(i, j int) bool

func (Drivers) Linkers

func (t Drivers) Linkers(names []string) Drivers

func (Drivers) LinkersRID

func (t Drivers) LinkersRID(names []string) []string
func (t Drivers) ResolveLink(to string) (Driver, bool)

ResolveLink returns the driver instance targeted by <to>

func (Drivers) Reverse

func (t Drivers) Reverse()

Reverse reverses the driver list sort.

func (Drivers) Sort

func (t Drivers) Sort()

Sort sorts the driver list.

func (Drivers) Swap

func (t Drivers) Swap(i, j int)

func (Drivers) Union

func (t Drivers) Union(other Drivers) Drivers

Union return a deduplicated list containing all drivers from t and other.

type EncapAPIer

type EncapAPIer interface {
	// EncapAPIURL returns the url of the guest daemon, empty when the
	// container offers none. A url does not say the daemon answers.
	EncapAPIURL(ctx context.Context) (string, error)

	// EncapAPIBearer returns the token proving the hypervisor to the
	// guest daemon.
	EncapAPIBearer(ctx context.Context) (string, error)
}

EncapAPIer is the Encaper whose guest daemon may be reached directly.

type Encaper

type Encaper interface {
	GetHostname() string
	GetOsvcRootPath() string
	EncapCp(context.Context, string, string) error
	EncapCmd(ctx context.Context, args []string, envs []string, stdin io.Reader) (Commander, error)
}

type File

type File struct {
	Checksum string    `json:"csum"`
	Mtime    time.Time `json:"mtime"`
	Name     string    `json:"name"`
	Ingest   bool      `json:"ingest"`
}

type Files

type Files []File

func (Files) Lookup

func (t Files) Lookup(name string) (File, bool)

type FinalSyncer

type FinalSyncer interface {
	// FinalSyncsTo says whether the resource replicates to the node.
	FinalSyncsTo(nodename string) bool
}

FinalSyncer is a sync resource able to send its data from an instance stopped, as a switch asks of its source before the destination starts: the replication of a dataset, which a snapshot freezes whether it is mounted or not. A sync reading files through a mount point is not one, the stop having unmounted it.

type FollowerProvisioner

type FollowerProvisioner interface {
	ProvisionAsFollower(context.Context) error
}

type FollowerUnprovisioner

type FollowerUnprovisioner interface {
	UnprovisionAsFollower(context.Context) error
}

type Freer

type Freer interface {
	CurrentFree(ctx context.Context) (int64, error)
}

Freer is implemented by a resource that can say how much of what it holds nothing has taken yet, which is what "{<rid>.free}" answers.

It is the other half of Sizer: a volume group says how big it is and how much of it is unused, and a logical volume carved from it is sized from the second.

type GetHostnamer

type GetHostnamer interface {
	GetHostname() string
}

GetHostnamer exposes a GetHostname method a resource can call to get the hostname used by ip resources to obtain a hostname-based DNS record

type HeadSnapshotter

type HeadSnapshotter interface {
	SnapshotHead(ctx context.Context, name string) (dir string, release func() error, ok bool, err error)
}

HeadSnapshotter is a resource whose head its storage takes point-in-time snapshots of: a run of a sync resource copies the snapshot rather than the head, so the writes it quiesced resume once the snapshot is taken. SnapshotHead returns the directory holding the snapshot and how to release it, and ok false when the storage of this head takes none.

type Hold

type Hold struct {
	Class string `json:"class"`
	Value string `json:"value"`
}

Hold is a value a resource holds on a node once provisioned and started, which no other object's resource may hold on that node: a mount point, a block device, the name of a volume group, an address.

The class tells values apart across drivers: a block device an fs mounts and a block device a volume group is made of are the same thing, whichever driver says it.

func HoldsOf

func HoldsOf(class string, values ...string) []Hold

HoldsOf returns a hold of the class for each value.

func (Hold) Excludes

func (t Hold) Excludes(o Hold) bool

Excludes says whether two objects cannot hold the two holds: the same value of the same class, but for the uses of a volume, which exclude each other unless both are shared.

func (Hold) IsVolume

func (t Hold) IsVolume() bool

IsVolume says whether the hold is a use of a volume, exclusive or shared.

type HoldSource

type HoldSource interface {
	// Get returns the value of an option of the resource section,
	// and false when it does not evaluate without running anything:
	// a reference to what another resource exposes once
	// provisioned, as {disk#1.exposed_devs}, or to the head of a
	// volume. Such a value is held by the resource it comes from,
	// whose own holds say it.
	Get(option string) (string, bool)

	// Path is the path of the object of the resource.
	Path() naming.Path

	// RID is the identifier of the resource.
	RID() string
}

HoldSource reads the configuration of a resource for the values it holds, as evaluated for one node.

type Holder

type Holder interface {
	Holds(HoldSource) []Hold
}

Holder is implemented by the drivers whose resources hold values. It is called on a driver allocated and not configured: the values come from the source alone, and nothing runs.

type Holds

type Holds []Hold

Holds are the values a resource holds, published as their values by class, the class said by its code:

{"bdev": ["/dev/sdb", "/dev/sdc"], "mnt": ["/srv/app"]}

A resource holds a few values of fewer classes, each said once.

func (Holds) MarshalJSON

func (t Holds) MarshalJSON() ([]byte, error)

MarshalJSON publishes the holds as their values by class code. A class without a code, published by a newer node, is said as it is.

func (*Holds) UnmarshalJSON

func (t *Holds) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the holds MarshalJSON publishes, sorted by class and value.

type Hook

type Hook int
const (
	Pre Hook = iota
	Post
)

type IDMapper

type IDMapper interface {
	HostUID(id uint32) (uint32, error)
	HostGID(id uint32) (uint32, error)
}

IDMapper is implemented by a resource whose processes run with ids of their own, mapped to other ids of the host, as the processes of a rootless container are mapped to the subordinate ids of its user.

It answers {<rid>.uid.<id>} and {<rid>.gid.<id>}: the host id a file has to be owned by for the id <id> of the resource to own it.

type Info

type Info struct {
	RID  string
	Keys InfoKeys
}

func GetInfo

func GetInfo(ctx context.Context, r Driver) (Info, error)

type InfoKey

type InfoKey struct {
	Key   string
	Value string
}

func (InfoKey) String

func (t InfoKey) String() string

type InfoKeys

type InfoKeys []InfoKey

type Infos

type Infos struct {
	ObjectPath naming.Path
	Resources  []Info
}

func NewInfos

func NewInfos(p naming.Path) Infos

func (Infos) String

func (t Infos) String() string

type LeaderProvisioner

type LeaderProvisioner interface {
	ProvisionAsLeader(context.Context) error
}

type LeaderUnprovisioner

type LeaderUnprovisioner interface {
	UnprovisionAsLeader(context.Context) error
}

type Level

type Level string

Level can be "error", "warn", "info"

var (
	InfoLevel  Level = "info"
	WarnLevel  Level = "warn"
	ErrorLevel Level = "error"
)

type LinkNameser

type LinkNameser interface {
	LinkNames() []string
}

type LinkToer

type LinkToer interface {
	LinkTo() string
}

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader uses a Reader to load a JSON Resource configuration into the resource struct.

func NewLoader

func NewLoader(r io.Reader) *Loader

NewLoader allocates a new Loader and returns a reference.

func (*Loader) Load

func (l *Loader) Load(v interface{}) error

Load JSON-decodes data from the Reader and load it at a Resource address

type MoveStorageCopier

type MoveStorageCopier interface {
	MoveCopiesStorage() bool
}

MoveStorageCopier is implemented by a resource holding disks of a moveable driver (eg container.kvm) that the destination of a move can not reach, as a zfs dataset is imported on one node at a time. The move then mirrors the content of those disks to the destination while the container runs, onto the copy PreMove made there.

The disks of the other resources are shared, as on a drbd in dual primary, and copying them would write each block onto itself.

type Mover

type Mover interface {
	Move(ctx context.Context, to string) error
}

Mover implements a Move function that is exposed by resource drivers that support live migration (eg container.kvm).

type NetNSPather

type NetNSPather interface {
	NetNSPath(context.Context) (string, error)
}

NetNSPather exposes a NetNSPath method a resource can call to get the string identifying the network namespace for libs like netlink. For example, the container.docker driver's NetNSPath() would return the SandboxKey

type ObjectDriver

type ObjectDriver interface {
	Log() *plog.Logger
	VarDir() string
	ResourceByID(string) Driver
	ResourcesByDrivergroups([]driver.Group) Drivers
}

type ObjectHold

type ObjectHold struct {
	RID string `json:"rid"`
	Hold
	Nodes   []string `json:"nodes,omitempty"`
	Cluster bool     `json:"cluster,omitempty"`
}

ObjectHold is a value a resource of an object holds, and where: on the nodes listed, or on every cluster node, for a shared resource, whose values are reachable from every node. A node joining the cluster is held on by a cluster-wide hold with nothing republished.

func (ObjectHold) HeldOn

func (t ObjectHold) HeldOn(node string) bool

HeldOn says whether the hold is held on the node.

func (ObjectHold) Overlaps

func (t ObjectHold) Overlaps(o ObjectHold) bool

Overlaps says whether the two holds hold the same value on a node, one excluding the other.

type PGPather

type PGPather interface {
	PGPath() string
}

PGPather is implemented by a resource whose processes are placed elsewhere than its process group id says, as a rootless container is placed under the cgroup subtree systemd delegates to its user.

PGPath answers the cgroup its processes run in, relative to the cgroup root, or an empty string when it is not known.

type PIDer

type PIDer interface {
	PID(context.Context) int
}

PIDer exposes a PID method a resource can call to get the head pid of the head process started by the resource. Typically a container resource PID() returns the pid of the first process of the container. PID() must return 0 when no process is running.

type PeerDependentStatuser

type PeerDependentStatuser interface {
	StatusDependsOnPeers() bool
}

devReservabler is an interface implemented by resource drivers that want the core resource to handle SCSI persistent reservation on a list of devices. PeerDependentStatuser is implemented by the drivers whose status reads a state the actions of the peer instances change, like the roles of a replicated device, which a peer swaps when it starts. The daemon evaluates such a status again when a peer instance changes, as nothing local tells it the state moved.

type PeerSyncer

type PeerSyncer interface {
	// SyncsTo says whether the resource replicates to the node.
	SyncsTo(nodename string) bool
	// SyncSource returns the path the resource reads.
	SyncSource() string
}

PeerSyncer is a sync resource replicating files to peer nodes, read through a mount point: it sends from an instance stopped only when the resource mounting its source is standby, mounted still.

type PoolCharger

type PoolCharger interface {
	PoolCharge() (head string, size int64)
}

PoolCharger is implemented by a resource taking its storage from something a pool owns: a logical volume from a volume group, a file from a directory.

It says what it takes, and what it takes it from, named as a pool names what it is the head of. What owns that head, and whether anything does, is not the resource's to know.

The size answered is the one the configuration asks for rather than the one the resource holds: what a volume costs a pool is weighed before anything is provisioned, and a resource that holds nothing yet still costs what it was asked to hold. A resource asking for no size, or for a share of what it rests on, answers zero: what it takes is not a number anything can be rationed by.

type PostMover

type PostMover interface {
	PostMove(ctx context.Context, to string) error
}

PostMover implements a PostMove function that is called by a moveable driver (eg container.kvm) after the move is done.

type PreMoveRollbacker

type PreMoveRollbacker interface {
	PreMoveRollback(ctx context.Context, to string) error
}

PreMoveRollbacker implements a PreMove rollback function that is called by a moveable driver (eg container.kvm) when move has failed.

type PreMover

type PreMover interface {
	PreMove(ctx context.Context, to string) error
}

PreMover implements a PreMove function that is called by a moveable driver (eg container.kvm) before starting a move.

type ProjectQuotaUser

type ProjectQuotaUser interface {
	ProjectQuotaUsage(ctx context.Context) (used, hard int64, ok bool, err error)
}

ProjectQuotaUser is a resource holding a directory bounded by a project quota, which says what the directory holds and may hold.

type ProvisionPreflighter

type ProvisionPreflighter interface {
	// ProvisionConflicts returns what holds what the resource would
	// take, empty when nothing does.
	ProvisionConflicts(ctx context.Context) []string
}

ProvisionPreflighter is implemented by the drivers that can tell, before their resource is provisioned, that something on the node holds what the provision would take: a filesystem mounted on the mount point, a volume group of the name, a device in use. The provision would otherwise adopt it, or format it.

type ProvisionStarter

type ProvisionStarter interface {
	ProvisionStart(context.Context) error
}

type ProvisionStatus

type ProvisionStatus struct {
	Mtime time.Time     `json:"mtime,omitempty"`
	State provisioned.T `json:"state"`
}

ProvisionStatus define if and when the resource became provisioned.

type ProvisionedFlag

type ProvisionedFlag struct {
	// contains filtered or unexported fields
}

ProvisionedFlag is the provisioned flag of a resource as its file holds it, read before a status evaluation of the resource: a found up the evaluation records holds only for a flag that did not change meanwhile.

func ReadProvisionedFlag

func ReadProvisionedFlag(r Driver) ProvisionedFlag

ReadProvisionedFlag returns the provisioned flag of the resource as its file holds it now.

type ProvisionedStater

type ProvisionedStater interface {
	HasProvisionedState() bool
}

ProvisionedStater is implemented by the drivers with nothing to provision whose resource has a provisioned state all the same, when HasProvisionedState says so: something its unprovision releases, as an address kept on a lan network. The state is the one of a resource with a provisioner: cached, read from the driver at the first status, set by a provision and cleared by an unprovision.

type Quiescer

type Quiescer interface {
	Quiesce(context.Context) (func(context.Context) error, error)
}

Quiescer is a resource whose writes a run of a sync resource suspends, for the data it saves to be consistent: quiesced before the run, in the order of a stop, resumed after it, in the order of a start. Quiesce returns how to resume them, nil when the resource quiesces nothing.

type ResizeHandsOuter

type ResizeHandsOuter interface {
	ResizeHandsOut(ctx context.Context) (func(below int64) int64, error)
}

ResizeHandsOuter is implemented by a Resizer that can say what it hands out to the link above it when the link below it holds a given size. It is the inverse of ResizePlan: a volume group given a physical volume of below hands out below less its metadata, rounded down to whole extents, where ResizePlan adds the metadata and rounds up.

It is what a resize asked of a volume works with. The size of a volume is the size of the bottom of its chain, which is what its pool and the claims of its namespace count, so the size its head has to reach is worked out from it, up the chain, one link at a time. The links are then asked for that head size from the top down, as a resize of the head is, and the bottom ends up asked for about the size it was given.

ResizeHandsOut measures what the answer rests on, an extent size or a header offset, once, and answers the function working it out for a size below: a resize refusing a size that grows nothing searches for the smallest one that does, and asks it of many sizes.

The function answers no more than the link hands out: ResizePlan asked for the answer asks no more than below of the link below, give or take the rounding to the unit of that link, and it never answers less for more below. A link not implementing it, or with nothing below it, hands out what is below it.

type ResizeIsReplicated

type ResizeIsReplicated interface {
	ResizeIsReplicated() bool
}

ResizeIsReplicated is implemented by a resource whose size is shared with peer nodes, so it can only be resized once every node has grown what is under it: a drbd resource offers what its smallest replica holds.

A resize chain is walked in two phases because of it. Every node first grows the links below the replicated one, and only then does the node holding the object up resize the replicated link and what rests on it.

type ResizeProvides

type ResizeProvides interface {
	ResizeProvides(ctx context.Context) string
}

ResizeProvides is implemented by a resource others rest on by name rather than through a device. A volume group answers "vg/<its name>".

type ResizeRestsOn

type ResizeRestsOn interface {
	ResizeRestsOn(ctx context.Context) string
}

ResizeRestsOn is implemented by a resource that rests on another resource of the same object that no device leads to. A logical volume rests on its volume group, but a volume group exposes logical volumes rather than itself, so nothing in the device topology connects the two.

It answers the name the resource below answers to, like "vg/data", or "" when there is nothing to name.

type ResizeSpansBelow

type ResizeSpansBelow interface {
	ResizeSpansBelow() bool
}

ResizeSpansBelow is implemented by a resource grown onto what is under it rather than to a size of its own. A filesystem is: it is told to take up the device it sits on, and the size it reports is that device.

A volume group and a drbd resource are grown the same way, keeping a cut of the device for their own metadata. What they report is the device less that cut, which their own plan computes: a link that has taken what is under it asks of it what it holds.

Such a resource cannot be told by its size whether it still has to grow. A chain grows from the bottom up, so the device under it already holds the new size by the time it is asked, and comparing the two says there is nothing to do when the filesystem has not been grown at all. So it is grown whenever something below it was.

type ResizeTargeter

type ResizeTargeter interface {
	ResizeTarget(ctx context.Context) (naming.Path, error)
}

ResizeTargeter is implemented by a resource that holds no size of its own, but stands for a resource of another object that does: a volume resource stands for the head of the volume it points at.

A resize chain reaching such a resource continues in the named object, from that object's head, and the resource itself drops out of the chain: there is nothing in it to change.

type ResizeUniter

type ResizeUniter interface {
	ResizeUnit(ctx context.Context) (int64, error)
}

ResizeUniter is implemented by a Resizer that grows by whole units, a logical volume by extents, a zvol by blocks. A size that grows nothing is refused with the smallest size that does, which is a whole number of them. A resource not implementing it grows by sectors.

type Resizer

type Resizer interface {
	ResizePlan(ctx context.Context, to int64) (needBelow int64, err error)
	Resize(ctx context.Context, to int64) error
}

Resizer is implemented by a resource driver that can change its size.

ResizePlan is asked first, of every link of the chain, and changes nothing. It answers the size this resource needs from the resources below it, which is not always the size it was asked for: a raid6 md holding n devices needs to(n-2) from each of them. It errors to refuse, naming what it cannot do, so that a chain is refused whole rather than left half resized - an xfs filesystem cannot grow beyond its device, and finding that out after the device under it has shrunk is data loss.

Resize is asked second, of the same links, once every one of them has agreed.

type Restart

type Restart struct {
	// Count is how many times imon should try to restart before giving up.
	Count int

	// Delay is the duration between 2 restarts.
	Delay *time.Duration
}

func (*Restart) GetRestart

func (t *Restart) GetRestart() Restart

func (*Restart) SetRestart

func (t *Restart) SetRestart(n *Restart)

type Runner

type Runner interface {
	Run(ctx context.Context) error
}

Runner implements the Run func, which runs a one-shot process Implemented by the resource. The object "run" action causes selected Runners to call Run().

type RunningInfo

type RunningInfo struct {
	PID       int       `json:"pid"`
	RID       string    `json:"rid"`
	SessionID uuid.UUID `json:"session_id"`
	At        time.Time `json:"at"`
}

RunningInfo describes a run in progress (for sync and task).

type RunningInfoList

type RunningInfoList []RunningInfo

RunningInfoList is the list of the in-progress run info (for sync and task).

func (*RunningInfoList) Has

func (t *RunningInfoList) Has(rid string) bool

Has is true if the rid is found running in the Instance Monitor data sent by the daemon.

func (*RunningInfoList) LoadRunDir

func (t *RunningInfoList) LoadRunDir(rid string, runDir runfiles.Dir) error

type Runninger

type Runninger interface {
	Running() (RunningInfoList, error)
}

Runninger implements the Running func, which the core calls when evaluating an object instance status to build the "running" list: [{"pid": 123, "rid": "task#1", "session_id": "abcd..."}]

type SCSIPersistentReservation

type SCSIPersistentReservation struct {
	Key            string
	NoPreemptAbort bool
	Enabled        bool
}

func (SCSIPersistentReservation) IsSCSIPersistentReservationEnabled

func (t SCSIPersistentReservation) IsSCSIPersistentReservationEnabled() bool

func (SCSIPersistentReservation) IsSCSIPersistentReservationPreemptAbortDisabled

func (t SCSIPersistentReservation) IsSCSIPersistentReservationPreemptAbortDisabled() bool

func (SCSIPersistentReservation) PersistentReservationKey

func (t SCSIPersistentReservation) PersistentReservationKey() string

type SSH

type SSH struct {
	// contains filtered or unexported fields
}

SSH represents a configuration for SSH-based interactions, including the private key file used for authentication.

func (*SSH) GetSSHKeyFile

func (t *SSH) GetSSHKeyFile() string

func (*SSH) NewSSHClient

func (t *SSH) NewSSHClient(nodename string, opts ...funcopt.O) (*ssh.Client, error)

func (*SSH) SetSSHKeyFile

func (t *SSH) SetSSHKeyFile()

SetSSHKeyFile implements SetSSHKeyFiler

type ScheduleOptions

type ScheduleOptions struct {
	Action              string
	MaxParallel         int
	Option              string
	Base                string
	RequireCollector    bool
	RequireProvisioned  bool
	RequireConfirmation bool
	RunDir              string
	Require             string

	// On are the events running the action, and Pace paces
	// these runs.
	On   []string
	Pace string

	// RequireReplicationSource schedules the action on the node the
	// data of the object is replicated from only, the one
	// instance.Status.ReplicationSource says is.
	RequireReplicationSource bool

	// Log asks the scheduled runs logged, as schedule.Config.Log.
	Log bool
}

ScheduleOptions contains the information needed by the object to create a schedule.Entry to append to the object's schedule.Table.

type Scheduler

type Scheduler interface {
	Schedules() schedule.Table
}

Scheduler implements the Schedules func, which returns the list of schedulable job definition on behalf of the resource.

type SetSSHKeyFiler

type SetSSHKeyFiler interface {
	SetSSHKeyFile()
}

type Setenver

type Setenver interface {
	Setenv()
}

type SizeInfoKeyer

type SizeInfoKeyer interface {
	SizeInfoKey() string
}

SizeInfoKeyer is implemented by a Sizer whose size is not its own, to name the key it is reported under in the resource info. A fs.directory reports the size of the filesystem holding it, and calling that "size" next to "driver fs.directory" reads as the size of the directory.

type Sizer

type Sizer interface {
	CurrentSize(ctx context.Context) (int64, error)
}

Sizer is implemented by a resource driver that knows how much space it holds. It is what a relative resize resolves against, and what decides how much a resize has to grow it.

It is not called Size because a driver whose size is configurable holds that keyword in a Size field, and the two are not the same thing: one is what was asked for, this is what is there.

type Snapshot

type Snapshot struct {
	// ID is om's snapshot id: the session id of the action
	// shared by every resource of one sync update, which
	// --snapshot takes.
	ID string `json:"id"`

	// CreatedAt is when the snapshot was taken.
	CreatedAt time.Time `json:"created_at"`

	// Cluster is the name of the cluster of the node that took it:
	// several clusters may write one store.
	Cluster string `json:"cluster"`

	// Node is the node that took it.
	Node string `json:"node"`

	// Protected says the retention keeps it, and Note is the text
	// it was marked with.
	Protected bool   `json:"protected,omitempty"`
	Note      string `json:"note,omitempty"`

	// Members are what it holds: the heads, by resource id, and
	// the configuration of the object.
	Members []string `json:"members"`

	// Location is where it is: the store holding it.
	Location string `json:"location"`
}

Snapshot is a point in time a sync resource can restore.

type SnapshotLister

type SnapshotLister interface {
	Snapshots(context.Context) ([]Snapshot, error)
}

SnapshotLister is a sync resource holding restorable points in time.

type StartBlocker

type StartBlocker struct {
	// Reason says what blocks the start, as "drbd r0 disk Outdated".
	Reason string `json:"reason"`

	// Resync says a resync from a peer holding the data up to date
	// lifts it, which a standby start of the object starts.
	Resync bool `json:"resync,omitempty"`

	// Path is the object whose standby start starts the resync, as the
	// volume of a volume resource, and empty for the object of the
	// resource itself.
	Path string `json:"path,omitempty"`
}

StartBlocker says why the instance of a node can not start now, and whether a resync lifts it. A switch waits, before it stops the source, for the blockers of the destination a resync lifts, and is refused a destination whose blockers no resync lifts.

type StartBlockerer

type StartBlockerer interface {
	StartBlocker(context.Context) *StartBlocker
}

StartBlockerer is a resource able to say what would refuse a start of the instance on this node now, as a replicated disk left behind while its peer ran, which a promotion refuses until a resync brings it up to date.

type Status

type Status struct {
	ResourceID    *resourceid.T    `json:"-"`
	Label         string           `json:"label"`
	Log           []StatusLogEntry `json:"log,omitempty"`
	Status        status.T         `json:"status"`
	Type          string           `json:"type"`
	IsProvisioned ProvisionStatus  `json:"provisioned,omitempty"`
	IsMonitored   bool             `json:"monitor,omitempty"`
	IsDisabled    bool             `json:"disable,omitempty"`
	IsOptional    bool             `json:"optional,omitempty"`
	IsEncap       bool             `json:"encap,omitempty"`
	IsStandby     bool             `json:"standby,omitempty"`
	IsStopped     bool             `json:"stopped,omitempty"`

	// Subset is the name of the subset this resource is assigned to.
	Subset string `json:"subset,omitempty"`

	// OutdatedAt is when this status changes with no event to tell,
	// as a copy aging past its delay. Zero if it does not.
	OutdatedAt time.Time `json:"outdated_at,omitzero"`

	// RPOBreachedAt is when the copy this resource keeps on the node
	// breaches, or breached, its recovery point objective: past it,
	// the node taking over would lose more data than the contract of
	// the resource allows. Zero where the resource keeps no copy, as
	// on the node the data is replicated from.
	RPOBreachedAt time.Time `json:"rpo_breached_at,omitzero"`

	// DependsOnPeers says the status reads a state the actions of the
	// peer instances change, so the daemon evaluates it again when a
	// peer instance status changes.
	DependsOnPeers bool `json:"depends_on_peers,omitempty"`

	// StartBlocker says what would refuse a start of the resource on
	// this node now, nil when nothing would.
	StartBlocker *StartBlocker `json:"start_blocker,omitempty"`

	// ConfigError is the error of the configuration of the resource
	// its undef status is due to, set when the resource holds
	// nothing on the node: its start refuses that configuration
	// before it sets anything up, and nothing a former start set up
	// is found. A change of that configuration is what fixes it, and
	// is not refused as the one of a resource up.
	ConfigError string `json:"config_error,omitempty"`

	// Info is a list of key-value pairs providing interesting information to
	// collect site-wide about this resource.
	Info map[string]any `json:"info,omitempty"`

	// Tags is a set of words attached to the resource.
	Tags TagSet `json:"tags,omitempty"`

	// Holds are the values the resource holds on the node while up,
	// as found running rather than as configured: the block devices
	// it exposes and the ones it is made on, as a filesystem on the
	// device another resource exposes. A configuration holding one
	// of them on this node is refused.
	Holds Holds `json:"holds,omitempty"`

	// Files exposes the list of files the driver wants the daemon to replicate
	// from the primary instance to secondary instances.
	Files Files `json:"files,omitempty"`

	// SyncScope says which instances share the Files: a node fetches
	// them from a peer only when the resource has the same scope on
	// both, as a container named differently on each node does not.
	SyncScope string `json:"sync_scope,omitempty"`

	// Datastores is the list of datastores used by the resource.
	// The daemon must watch for these datastore changes
	// (e.g. reinstall files in fs and volumes)
	Datastores naming.Paths `json:"datastores,omitempty"`

	// Volumes is the list of the vol objects the resource uses: the
	// one a volume resource is, as named or by default.
	Volumes naming.Paths `json:"volumes,omitempty"`
}

Status is the structure representing the resource status, which is embedded in the instance status.

func GetStatus

func GetStatus(ctx context.Context, r Driver) Status

GetStatus returns the resource Status for embedding into the instance.Status.

func (*Status) DeepCopy

func (t *Status) DeepCopy() *Status

func (Status) IPAddrs

func (t Status) IPAddrs() []string

IPAddrs returns the addresses the resource publishes, the first being the one of IPAddrInfoKey.

func (*Status) IsDisabledFlag

func (t *Status) IsDisabledFlag() string

IsDisabledFlag returns a one character representation of the IsDisabled state.

func (*Status) IsEncapFlag

func (t *Status) IsEncapFlag() string

IsEncapFlag returns a one character representation of the IsEncap state.

func (*Status) IsMonitoredFlag

func (t *Status) IsMonitoredFlag() string

IsMonitoredFlag returns a one character representation of the IsMonitored state.

func (*Status) IsOptionalFlag

func (t *Status) IsOptionalFlag() string

IsOptionalFlag returns a one character representation of the IsOptional state.

func (*Status) IsProvisionedFlag

func (t *Status) IsProvisionedFlag() string

IsProvisionedFlag returns a one character representation of the IsProvisioned state.

func (*Status) IsStandbyFlag

func (t *Status) IsStandbyFlag() string

IsStandbyFlag returns a one character representation of the IsStandby state.

func (*Status) RestartFlag

func (t *Status) RestartFlag(restart, retries int) string

RestartFlag returns a one character representation of the Restart state.

func (*Status) Unstructured

func (t *Status) Unstructured() map[string]any

type StatusInfoSchedAction

type StatusInfoSchedAction struct {
	Last time.Time `json:"last"`
}

type StatusInfoer

type StatusInfoer interface {
	StatusInfo(context.Context) map[string]interface{}
}

StatusInfoer implements the StatusInfo func, which returns a resource specific key-val mapping pushed to the collector on "pushinfo" action.

type StatusLog

type StatusLog struct {
	// contains filtered or unexported fields
}

StatusLog holds the information, warning and alerts of a Resource

func NewStatusLog

func NewStatusLog(entries ...StatusLogEntry) *StatusLog

func (*StatusLog) ChangeAt

func (l *StatusLog) ChangeAt() time.Time

ChangeAt is the earliest time recorded by ChangesAt, zero if none.

func (*StatusLog) ChangesAt

func (l *StatusLog) ChangesAt(tm time.Time)

ChangesAt records that the status evaluated changes at tm with no event to tell, for the daemon to evaluate it again then. The earliest of the times recorded is kept, and a time already past is ignored: the status evaluated has seen it.

func (*StatusLog) Entries

func (l *StatusLog) Entries() []StatusLogEntry

func (*StatusLog) Error

func (l *StatusLog) Error(s string, args ...any)

Error append an error message to the log

func (*StatusLog) Info

func (l *StatusLog) Info(s string, args ...any)

Info append an info message to the log

func (*StatusLog) Len

func (l *StatusLog) Len() int

func (*StatusLog) Merge

func (l *StatusLog) Merge(other StatusLogger)

func (*StatusLog) RPOBreachAt

func (l *StatusLog) RPOBreachAt() time.Time

RPOBreachAt is the earliest time recorded by RPOBreachesAt, zero if none.

func (*StatusLog) RPOBreachesAt

func (l *StatusLog) RPOBreachesAt(tm time.Time)

RPOBreachesAt records that a copy the resource keeps on this node, as the one a sync received, breaches its recovery point objective at tm: were the node to take over from then on, more data would be lost than its contract allows. The earliest time recorded is kept, past or not.

func (*StatusLog) Reset

func (l *StatusLog) Reset()

func (*StatusLog) Warn

func (l *StatusLog) Warn(s string, args ...any)

Warn append a warning message to the log

type StatusLogEntry

type StatusLogEntry struct {
	Level   Level  `json:"level"`
	Message string `json:"message"`
}

StatusLogEntry is an element of LogType.Log

func (StatusLogEntry) String

func (t StatusLogEntry) String() string

type StatusLogger

type StatusLogger interface {
	Info(string, ...any)
	Warn(string, ...any)
	Error(string, ...any)
	Len() int
	Reset()
	Entries() []StatusLogEntry
	Merge(StatusLogger)
	ChangesAt(time.Time)
	ChangeAt() time.Time
	RPOBreachesAt(time.Time)
	RPOBreachAt() time.Time
}

type SubDeviceser

type SubDeviceser interface {
	SubDevices(context.Context) device.L
}

type T

type T struct {
	ResourceID              *resourceid.T
	Subset                  string
	Disable                 bool
	Monitor                 bool
	Optional                bool
	Standby                 bool
	Shared                  bool
	Encap                   bool
	Tags                    *set.Set
	BlockingPreStart        string
	BlockingPreStop         string
	BlockingPreRun          string
	BlockingPreProvision    string
	BlockingPreUnprovision  string
	PreStart                string
	PreStop                 string
	PreRun                  string
	PreProvision            string
	PreUnprovision          string
	BlockingPostStart       string
	BlockingPostStop        string
	BlockingPostRun         string
	BlockingPostProvision   string
	BlockingPostUnprovision string
	PostStart               string
	PostStop                string
	PostRun                 string
	PostProvision           string
	PostUnprovision         string
	StartRequires           string
	StopRequires            string
	ProvisionRequires       string
	UnprovisionRequires     string
	UpdateRequires          string
	RunRequires             string
	EnableProvision         bool
	EnableUnprovision       bool
	// contains filtered or unexported fields
}

T is the resource type, embedded in each drivers type

func (*T) ApplyPG

func (t *T) ApplyPG(ctx context.Context) error

ApplyPG applies the pg configuration for the parents pg and for this resource pg.

func (*T) GetConfigurationError

func (t *T) GetConfigurationError() error

func (*T) GetObject

func (t *T) GetObject() any

GetObject returns the object interface set by SetObjectriver upon configure.

func (*T) GetObjectDriver

func (t *T) GetObjectDriver() ObjectDriver

GetObjectDriver returns the object driver interface of the object set by SetObject upon configure.

func (*T) GetPG

func (t *T) GetPG() *pg.Config

GetPG returns the private pg resource field

func (*T) GetPGID

func (t *T) GetPGID() string

GetPGID returns the pg id configured via SetPG, or "" if unset

func (*T) ID

func (t *T) ID() *resourceid.T

ID returns the resource id struct

func (*T) IsActionDisabled

func (t *T) IsActionDisabled() bool

IsActionDisabled returns true if the resource definition contains tag=noaction ... In this case, the resource actions like stop and start are skipped.

func (*T) IsDisabled

func (t *T) IsDisabled() bool

IsDisabled returns true if the resource definition contains disable=true.

func (*T) IsEncap

func (t *T) IsEncap() bool

IsEncap returns true if the resource definition contains encap=true.

func (*T) IsMonitored

func (t *T) IsMonitored() bool

IsMonitored returns true if the resource definition contains monitor=true.

func (*T) IsOptional

func (t *T) IsOptional() bool

IsOptional returns true if the resource definition contains optional=true. An optional resource does not break an object action on error.

Resource having actions disabled are always considered optional, because there is nothing we can do to change the state, which would cause orchestration loops.

func (*T) IsProvisionDisabled

func (t *T) IsProvisionDisabled() bool

IsProvisionDisabled returns true if the resource definition contains provision=false.

func (*T) IsShared

func (t *T) IsShared() bool

IsShared returns true if the resource definition contains shared=true.

func (*T) IsStandby

func (t *T) IsStandby() bool

IsStandby returns true if the resource definition contains standby=true.

func (*T) IsStatusDisabled

func (t *T) IsStatusDisabled() bool

IsStatusDisabled returns true if the resource definition contains tag=nostatus ... In this case, the resource status is always n/a

func (*T) IsStopped

func (t *T) IsStopped() bool

IsStopped returns true if the stopped flag file exists.

func (*T) IsUnprovisionDisabled

func (t *T) IsUnprovisionDisabled() bool

IsUnprovisionDisabled returns true if the resource definition contains unprovision=false.

func (*T) Lock

func (t *T) Lock(disable bool, timeout time.Duration, intent string) (func(), error)

func (*T) Log

func (t *T) Log() *plog.Logger

Log returns the resource logger

func (*T) MatchRID

func (t *T) MatchRID(s string) bool

MatchRID returns true if:

  • the pattern is a just a drivergroup name and this name matches this resource's drivergroup ex: fs#1 matches fs
  • the pattern is a fully qualified resourceid, and its string representation equals the pattern. ex: fs#1 matches fs#1

func (*T) MatchSubset

func (t *T) MatchSubset(s string) bool

MatchSubset returns true if the resource subset equals the pattern.

func (*T) MatchTag

func (t *T) MatchTag(s string) bool

MatchTag returns true if one of the resource tags equals the pattern.

func (*T) RID

func (t *T) RID() string

RID returns the string representation of the resource id

func (*T) RSubset

func (t *T) RSubset() string

RSubset returns the resource subset name

func (*T) Requires

func (t *T) Requires(action string) *resourcereqs.T

func (*T) ResetPG

func (t *T) ResetPG(ctx context.Context) error

ResetPG lifts the capping of the process group of this resource, and of the groups above it the object owns.

It registers the group the way applying does, and lifts what is not lifted yet: the walk reaches every resource, and each call finds only its own group left to do.

func (*T) RunningFromLock

func (t *T) RunningFromLock(intent string) (RunningInfoList, error)

func (*T) SetConfigurationError

func (t *T) SetConfigurationError(err error)

func (*T) SetDisabled

func (t *T) SetDisabled(v bool)

SetDisable is used by the resource configurer to disable the resource if the instance is disabled.

func (*T) SetLoggerForTest

func (t *T) SetLoggerForTest(l *plog.Logger)

SetLoggerForTest can be used to set resource log for testing purpose

func (*T) SetObject

func (t *T) SetObject(o any)

SetObject holds the useful interface of the parent object of the resource.

func (*T) SetPG

func (t *T) SetPG(v *pg.Config)

SetPG sets the process group config parsed from the config

func (*T) SetRID

func (t *T) SetRID(v string) error

SetRID sets the resource identifier

func (*T) StatusLog

func (t *T) StatusLog() StatusLogger

StatusLog returns a reference to the resource log

func (*T) TagSet

func (t *T) TagSet() TagSet

func (*T) Trigger

func (t *T) Trigger(ctx context.Context, blocking trigger.Blocking, hook trigger.Hook, action trigger.Action) error

func (*T) VarDir

func (t *T) VarDir() string

VarDir is the full path of the directory where the resource can write its private variable data.

type TagSet

type TagSet []string

TagSet is the list of unique tag names found in the resource definition.

type TriggerCommander

type TriggerCommander interface {
	TriggerCommand(rid, hook string) (string, error)
}

TriggerCommander is an object evaluating the command of a trigger of its resources at the time the trigger runs, as a post trigger reads what the action made.

type UnprovisionStoper

type UnprovisionStoper interface {
	UnprovisionStop(ctx context.Context, leader bool) error
}

Jump to

Keyboard shortcuts

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