actor

package
v0.0.0-...-3430a5a Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CommandRequeue = NewCommand("", "CommandRequeue")
	CommandAbort   = NewCommand("", "CommandAbort")
	CommandPaused  = NewCommand("", "CommandPaused")
)

Functions

func Register

func Register(a core.Arch, f func(kubernetes.ClientSet, logr.Logger) Actor)

Types

type Actor

type Actor interface {
	// SupportedCommands return the supported commands of the actor
	SupportedCommands() []Command
	// Version return the version of the actor
	// if the version is different from the previous version, the actor will be reloaded
	Version() *semver.Version
	// Do run the actor
	Do(ctx context.Context, cluster types.RedisInstance) *ActorResult
}

Actor actor is used process instance with specified state

type ActorGroup

type ActorGroup map[string]VersionedActor

func (ActorGroup) Add

func (ag ActorGroup) Add(a Actor)

func (ActorGroup) All

func (ag ActorGroup) All() (ret [][]Actor)

func (ActorGroup) Get

func (ag ActorGroup) Get(cmd Command) []Actor

type ActorManager

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

ActorManager

func NewActorManager

func NewActorManager(cs kubernetes.ClientSet, logger logr.Logger) *ActorManager

NewActorManager

func (*ActorManager) Add

func (m *ActorManager) Add(arch core.Arch, a Actor)

Add

func (*ActorManager) Print

func (m *ActorManager) Print()

func (*ActorManager) Search

func (m *ActorManager) Search(cmd Command, inst Object) Actor

Search find the actor which match the version requirement (version >= actor.Version)

type ActorResult

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

ActorResult

func AbortWithError

func AbortWithError(err error) *ActorResult

func NewResult

func NewResult(cmd Command) *ActorResult

func NewResultWithError

func NewResultWithError(cmd Command, err error) *ActorResult

func NewResultWithValue

func NewResultWithValue(cmd Command, val interface{}) *ActorResult

func Pause

func Pause() *ActorResult

func Requeue

func Requeue() *ActorResult

func RequeueWithError

func RequeueWithError(err error) *ActorResult

func (*ActorResult) Err

func (c *ActorResult) Err() error

Err

func (*ActorResult) NextCommand

func (c *ActorResult) NextCommand() Command

Next

func (*ActorResult) Result

func (c *ActorResult) Result() interface{}

Result

type Command

type Command interface {
	String() string
}

func NewCommand

func NewCommand(arch core.Arch, command string) Command

type Object

type Object interface {
	GetAnnotations() map[string]string
	Arch() core.Arch
}

type VersionedActor

type VersionedActor []Actor

Jump to

Keyboard shortcuts

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