actioncontext

package
v3.0.0-rc72 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 7 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

This section is empty.

Variables

View Source
var (
	Boot = Properties{
		Name:            "boot",
		Target:          "booted",
		Progress:        "booting",
		Failure:         "boot failed",
		MustLock:        true,
		Order:           ordering.Desc,
		MarksStopped:    true,
		TimeoutKeywords: []string{"timeout"},
		PG:              true,
	}
	Delete = Properties{
		Name:     "delete",
		Target:   "deleted",
		Progress: "deleting",
		Failure:  "delete failed",
		Order:    ordering.Desc,
		MustLock: true,
	}
	Freeze = Properties{
		Name:     "freeze",
		Target:   "frozen",
		Progress: "freezing",
		Failure:  "freeze failed",
		PG:       true,
	}
	PRStart = Properties{
		Name:            "prstart",
		Failure:         "start failed",
		Progress:        "starting",
		Rollback:        true,
		TimeoutKeywords: []string{"start_timeout", "timeout"},
		PG:              true,
	}
	PRStop = Properties{
		Name:            "prstop",
		Failure:         "stop failed",
		MustLock:        true,
		Order:           ordering.Desc,
		Progress:        "stopping",
		TimeoutKeywords: []string{"stop_timeout", "timeout"},
		PG:              true,
	}
	Set = Properties{
		Name:     "set",
		MustLock: true,
	}
	SetProvisioned = Properties{
		Name:     "set provisioned",
		MustLock: true,
	}
	SetUnprovisioned = Properties{
		Name:     "set unprovisioned",
		MustLock: true,
	}
	Status = Properties{
		Name:      "status",
		PG:        true,
		MustLock:  true,
		LockGroup: "status",
	}
	Enable = Properties{
		Name:     "enable",
		MustLock: true,
	}
	Disable = Properties{
		Name:     "disable",
		MustLock: true,
	}
	Unset = Properties{
		Name:     "unset",
		MustLock: true,
	}
	ValidateConfig = Properties{
		Name:     "validate_config",
		MustLock: true,
	}
	Provision = Properties{
		Name:            "provision",
		Target:          "provisioned",
		Progress:        "provisioning",
		Failure:         "provision failed",
		MustLock:        true,
		Rollback:        true,
		TimeoutKeywords: []string{"provision_timeout", "timeout"},
		PG:              true,
	}
	PushResInfo = Properties{
		Name: "push resinfo",
		PG:   true,
	}
	// Install installs again what the volumes and the filesystems of the
	// instance declare, as their start does, without starting anything.
	Install = Properties{
		Name:     "install",
		MustLock: true,
		PG:       true,
	}
	Run = Properties{
		Name:            "run",
		TimeoutKeywords: []string{"run_timeout", "timeout"},
		PG:              true,
	}
	Shutdown = Properties{
		Name:            "shutdown",
		Target:          "shutdown",
		Progress:        "shutting",
		Failure:         "shutdown failed",
		Order:           ordering.Desc,
		TimeoutKeywords: []string{"stop_timeout", "timeout"},
		PG:              true,
		RemovesPG:       true,
	}
	PGUpdate = Properties{
		Name:     "pg_update",
		MustLock: true,
		PG:       true,
	}
	PGReset = Properties{
		Name:     "pg_reset",
		MustLock: true,
		PG:       true,
	}
	Start = Properties{
		Name:            "start",
		Target:          "started",
		Progress:        "starting",
		Failure:         "start failed",
		MustLock:        true,
		ClearsStopped:   true,
		Rollback:        true,
		TimeoutKeywords: []string{"start_timeout", "timeout"},
		PG:              true,
	}
	StartStandby = Properties{
		Name:            "startstandby",
		Progress:        "starting",
		Failure:         "start failed",
		MustLock:        true,
		Rollback:        true,
		TimeoutKeywords: []string{"start_timeout", "timeout"},
		PG:              true,
	}
	Stop = Properties{
		Name:            "stop",
		Target:          "stopped",
		Progress:        "stopping",
		Failure:         "stop failed",
		MustLock:        true,
		Order:           ordering.Desc,
		MarksStopped:    true,
		TimeoutKeywords: []string{"stop_timeout", "timeout"},
		PG:              true,
		RemovesPG:       true,
	}
	// ProvisionStop is the stop ending a provision off the placement
	// leader, which leaves stopped what the provision started on an
	// instance it found down.
	ProvisionStop = Properties{
		Name:            "stop",
		Target:          "stopped",
		Progress:        "stopping",
		Failure:         "stop failed",
		MustLock:        true,
		Order:           ordering.Desc,
		StepOf:          "provision",
		TimeoutKeywords: []string{"stop_timeout", "timeout"},
		PG:              true,
		RemovesPG:       true,
	}
	SyncFull = Properties{
		Name:     "full",
		MustLock: true,
		PG:       true,
	}
	SyncIngest = Properties{
		Name:     "sync_ingest",
		MustLock: true,
		PG:       true,
	}
	// RestoreStop and RestoreStart are the steps of a sync restore --stop
	// bringing the instance to the state a restore in place needs: the
	// resources using the heads stopped, the heads started. The restore
	// flags the instance stopped itself, and the start leaves the flag
	// raised, so the daemon starts nothing back on its own.
	RestoreStop = Properties{
		Name:            "stop",
		Target:          "stopped",
		Progress:        "stopping",
		Failure:         "stop failed",
		MustLock:        true,
		Order:           ordering.Desc,
		StepOf:          "sync_restore",
		TimeoutKeywords: []string{"stop_timeout", "timeout"},
		PG:              true,
	}
	RestoreStart = Properties{
		Name:            "start",
		Progress:        "starting",
		Failure:         "start failed",
		MustLock:        true,
		StepOf:          "sync_restore",
		TimeoutKeywords: []string{"start_timeout", "timeout"},
		PG:              true,
	}
	SyncRestore = Properties{
		Name:     "sync_restore",
		MustLock: true,
		PG:       true,
	}
	SyncResync = Properties{
		Name:     "sync_resync",
		MustLock: true,
		PG:       true,
	}
	SyncSplit = Properties{
		Name:     "sync_split",
		MustLock: true,
		PG:       true,
	}
	SyncUpdate = Properties{
		Name:     "update",
		MustLock: true,
		PG:       true,
	}
	Unfreeze = Properties{
		Name:     "unfreeze",
		Target:   "unfrozen",
		Progress: "unfreezing",
		Failure:  "unfreeze failed",
		PG:       true,
	}
	// Unstop lowers the flags a stop raised, as a start does, and starts
	// nothing: the daemon may start the instance, or restart the
	// resources, on its own again. It takes the action lock a start and a
	// stop take, so a stop running meanwhile does not raise a flag it
	// lowered, or the other way round.
	Unstop = Properties{
		Name:          "unstop",
		MustLock:      true,
		ClearsStopped: true,
	}
	Unprovision = Properties{
		Name:            "unprovision",
		Target:          "unprovisioned",
		Progress:        "unprovisioning",
		Failure:         "unprovision failed",
		MustLock:        true,
		Order:           ordering.Desc,
		TimeoutKeywords: []string{"unprovision_timeout", "timeout"},
		PG:              true,
		RemovesPG:       true,
	}
)

Functions

func AllSlaves

func AllSlaves(ctx context.Context) bool

func BeganAt

func BeganAt(ctx context.Context) time.Time

BeganAt returns when the action began, now outside an action.

func Env

func Env(ctx context.Context) []string

func HasProps

func HasProps(ctx context.Context) bool

HasProps tells whether the context carries the properties of an action.

func HasResourceSelector

func HasResourceSelector(ctx context.Context) bool

func IsActionForMaster

func IsActionForMaster(ctx context.Context) bool

func IsActionForSlave

func IsActionForSlave(ctx context.Context, nodename string) bool

func IsAdopt

func IsAdopt(ctx context.Context) bool

func IsConfirm

func IsConfirm(ctx context.Context) bool

func IsCron

func IsCron(ctx context.Context) bool

func IsFinalSync

func IsFinalSync(ctx context.Context) bool

func IsForce

func IsForce(ctx context.Context) bool

func IsForceAffinity

func IsForceAffinity(ctx context.Context) bool

IsForceAffinity says a start ignores the hard affinities of the object, asked by --force-affinity or --force.

func IsInterruptSyncs

func IsInterruptSyncs(ctx context.Context) bool

func IsLeader

func IsLeader(ctx context.Context) bool

func IsLockDisabled

func IsLockDisabled(ctx context.Context) bool

func IsLockTimeoutSet

func IsLockTimeoutSet(ctx context.Context) bool

func IsPreflight

func IsPreflight(ctx context.Context) bool

func IsQuiet

func IsQuiet(ctx context.Context) bool

func IsResourceSelected

func IsResourceSelected(ctx context.Context, path naming.Path, rid string) (selected, known bool)

IsResourceSelected tells whether the resource identified by rid, of the object at path, is among the ones recorded by WithSelectedRIDs. The known return value is false when no selection is recorded for this object, i.e. outside an action, during an action on all the resources, or during the status evaluation of another object, so the caller can apply its default policy.

func IsRollbackDisabled

func IsRollbackDisabled(ctx context.Context) bool

func IsStep

func IsStep(ctx context.Context) bool

IsStep tells whether the action of the context is a step of another action, which flags nothing stopped on purpose.

func LockTimeout

func LockTimeout(ctx context.Context) time.Duration

func Master

func Master(ctx context.Context) bool

func MoveTo

func MoveTo(ctx context.Context) string

func RID

func RID(ctx context.Context) string

func Slaves

func Slaves(ctx context.Context) []string

func Subset

func Subset(ctx context.Context) string

func SyncTo

func SyncTo(ctx context.Context) []string

SyncTo returns the nodes a stop sends the sync resources to once the instance is stopped.

func Tag

func Tag(ctx context.Context) string

func Target

func Target(ctx context.Context) []string

func To

func To(ctx context.Context) string

func Verbose

func Verbose(ctx context.Context) int

func WithAdopt

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

WithAdopt has a provision take over the system resources it finds holding what it would take, as replicated storage a restored object finds, rather than refuse them.

func WithAllSlaves

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

func WithBeganAt

func WithBeganAt(ctx context.Context, t time.Time) context.Context

WithBeganAt says when the action began, which the resources acting at different times of it share: the runs one sync update writes into several stores, under one snapshot id, carry this one time.

func WithConfirm

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

func WithCron

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

func WithEnv

func WithEnv(ctx context.Context, s []string) context.Context

func WithFinalSync

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

WithFinalSync says the sync is the last one of a stopped source, its destination not started: the sync of a source not started is allowed then, the data it would overwrite being older than its own.

func WithForce

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

func WithForceAffinity

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

WithForceAffinity has a start ignore the hard affinities of the object, as --force does among the other checks.

func WithInterruptSyncs

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

WithInterruptSyncs has a stop end the syncs running on the instance before stopping it, instead of waiting for the object lock they hold.

func WithLeader

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

func WithLockDisabled

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

func WithLockTimeout

func WithLockTimeout(ctx context.Context, d time.Duration) context.Context

func WithLockTimeoutSet

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

WithLockTimeoutSet says the lock timeout was given by the user, not defaulted: an action that would wait longer by default keeps to it.

func WithMaster

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

func WithMoveTo

func WithMoveTo(ctx context.Context, v string) context.Context

func WithPreflight

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

WithPreflight has a provision check only that nothing on the node holds what it would take, provisioning nothing.

func WithProps

func WithProps(ctx context.Context, props Properties) context.Context

func WithQuiet

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

func WithRID

func WithRID(ctx context.Context, s string) context.Context

func WithRestoreOptions

func WithRestoreOptions(ctx context.Context, o RestoreOptions) context.Context

func WithRollbackDisabled

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

func WithRunMarks

func WithRunMarks(ctx context.Context, m RunMarks) context.Context

func WithSelectedRIDs

func WithSelectedRIDs(ctx context.Context, path naming.Path, rids []string) context.Context

WithSelectedRIDs records the rids of the resources an action with a resource selection works on or reads the state of, for the object at path. Drivers read it with IsResourceSelected, for example to spare a provider api call on a resource the action does not depend on.

The path scopes the rids: an action can evaluate the status of another object with the same context, like the start affinity checks do, and the resources of that object must not be judged by this selection.

func WithSlaves

func WithSlaves(ctx context.Context, s []string) context.Context

func WithSubset

func WithSubset(ctx context.Context, s string) context.Context

func WithSyncTo

func WithSyncTo(ctx context.Context, nodes []string) context.Context

WithSyncTo has a stop send, once the instance is stopped, the sync resources replicating to these nodes, as a switch asks of its source before the destination starts.

func WithTag

func WithTag(ctx context.Context, s string) context.Context

func WithTarget

func WithTarget(ctx context.Context, s []string) context.Context

func WithTo

func WithTo(ctx context.Context, s string) context.Context

func WithVerbose

func WithVerbose(ctx context.Context, v int) context.Context

func WithoutResourceSelector

func WithoutResourceSelector(ctx context.Context) context.Context

WithoutResourceSelector returns the context of an action a resource runs on another object, as a volume resource does on its vol object. The resource selector of the action names resources of the object it runs on, so it must not select among the resources of the other object, which the resource acts on as a whole.

Types

type Properties

type Properties struct {
	Name      string
	Target    string
	Progress  string
	Failure   string
	Order     ordering.T
	MustLock  bool
	LockGroup string

	// MarksStopped says the action leaves the instance stopped on
	// purpose, so the daemon must not start it back on its own until
	// the object is wanted up again.
	MarksStopped bool

	// ClearsStopped says the action wants the instance up, so the
	// daemon may start it on its own again.
	ClearsStopped bool

	// StepOf names the action this one is a step of, and is empty for
	// an action asked for itself. A step flags nothing stopped on
	// purpose, neither the instance nor a resource: the user asked for
	// the action it is a step of, not for it.
	StepOf string

	Rollback        bool
	PG              bool
	TimeoutKeywords []string

	// RemovesPG says the action, unscoped, leaves nothing running in
	// the process groups of the object, which it removes when done,
	// with the systemd properties of their slices: a capping would
	// outlive the object otherwise, and cap the next one made under
	// the same name.
	RemovesPG bool
}

func Props

func Props(ctx context.Context) Properties

type RestoreOptions

type RestoreOptions struct {
	// Snapshot is the run to restore, by id or a prefix of it: the
	// latest run when empty.
	Snapshot string

	// Into is a directory to restore aside into, a directory per member,
	// instead of into the heads.
	Into string

	// Config asks the configuration of the object restored: in place, it
	// alone, aside, beside the heads.
	Config bool

	// ByRID asks each head restored into the current head of the resource
	// of its rid, rather than at the path it was saved from.
	ByRID bool

	// Stop asks the instance brought to the state a restore in place
	// needs, rather than the restore refused: the resources using the
	// heads stopped, the heads started, and the instance left stopped.
	Stop bool

	// Heads are the heads to restore, every head of the run when empty.
	Heads []string

	// Refs is how the keys of the sec and cfg the object references are
	// restored: missing, skip or overwrite, missing when empty.
	Refs string
}

RestoreOptions are the options of a sync restore.

func Restore

func Restore(ctx context.Context) RestoreOptions

type RunMarks

type RunMarks struct {
	Protect bool
	Note    string
}

RunMarks are what a sync update marks the run it writes with: protected from the retention, and a note, set when the run is written.

func RunMarksOf

func RunMarksOf(ctx context.Context) RunMarks

Jump to

Keyboard shortcuts

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