phase

package
v0.0.0-...-9b598c7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func PerformClusterOperation

func PerformClusterOperation(cluster *dbapi.ConnectorCluster, operation ClusterOperation,
	updatePhase ...func(connectorCluster *dbapi.ConnectorCluster) *errors.ServiceError) (updated bool, err *errors.ServiceError)

PerformClusterOperation is a utility method to change a cluster's phase and call optional functions to save updated phase first return value is true if the phase was changed and second value is an error if operation is not permitted in cluster's present phase

func PerformConnectorOperation

func PerformConnectorOperation(namespace *dbapi.ConnectorNamespace, connector *dbapi.Connector, operation ConnectorOperation,
	updatePhase ...func(connector *dbapi.Connector) *errors.ServiceError) (updated bool, err *errors.ServiceError)

PerformConnectorOperation is a utility method to change a connector's phase first return value is true if the phase was changed and second value is an error if operation is not permitted in connector's present phase

func PerformNamespaceOperation

func PerformNamespaceOperation(cluster *dbapi.ConnectorCluster, namespace *dbapi.ConnectorNamespace, operation NamespaceOperation,
	updatePhase ...func(namespace *dbapi.ConnectorNamespace) *errors.ServiceError) (updated bool, err *errors.ServiceError)

PerformNamespaceOperation is a utility method to change a namespace's phase first return value is true if the phase was changed and second value is an error if operation is not permitted in namespace's present phase

Types

type ClusterFSM

type ClusterFSM struct {
	Cluster *dbapi.ConnectorCluster
	// contains filtered or unexported fields
}

ClusterFSM handles cluster phase changes

func NewClusterFSM

func NewClusterFSM(cluster *dbapi.ConnectorCluster) *ClusterFSM

func (*ClusterFSM) Perform

func (c *ClusterFSM) Perform(operation ClusterOperation) (bool, *errors.ServiceError)

Perform tries to perform the given operation and updates the cluster phase, first return value is true if the phase was changed and second value is an error if operation is not permitted in cluster's present phase

type ClusterOperation

type ClusterOperation string
const (
	ConnectCluster    ClusterOperation = "connect"
	DisconnectCluster ClusterOperation = "disconnect"
	DeleteCluster     ClusterOperation = "delete"
)

type ConnectorFSM

type ConnectorFSM struct {
	Connector *dbapi.Connector
	// contains filtered or unexported fields
}

ConnectorFSM handles connector phase changes within it's cluster's current phase

func NewConnectorFSM

func NewConnectorFSM(namespace *dbapi.ConnectorNamespace, connector *dbapi.Connector) *ConnectorFSM

func (*ConnectorFSM) Perform

func (c *ConnectorFSM) Perform(operation ConnectorOperation) (bool, *errors.ServiceError)

Perform tries to perform the given operation and updates the connector desired state, first return value is true if the state was changed and second value is an error if operation is not permitted in connector's present state

type ConnectorOperation

type ConnectorOperation string
const (
	CreateConnector   ConnectorOperation = "create"
	AssignConnector   ConnectorOperation = "assign"
	UnassignConnector ConnectorOperation = "unassign"
	UpdateConnector   ConnectorOperation = "update"
	StopConnector     ConnectorOperation = "stop"
	RestartConnector  ConnectorOperation = "restart"
	DeleteConnector   ConnectorOperation = "delete"
)

type NamespaceFSM

type NamespaceFSM struct {
	Namespace *dbapi.ConnectorNamespace
	// contains filtered or unexported fields
}

NamespaceFSM handles namespace phase changes within it's cluster's current phase

func NewNamespaceFSM

func NewNamespaceFSM(cluster *dbapi.ConnectorCluster, namespace *dbapi.ConnectorNamespace) *NamespaceFSM

func (*NamespaceFSM) Perform

func (c *NamespaceFSM) Perform(operation NamespaceOperation) (bool, *errors.ServiceError)

Perform tries to perform the given operation and updates the namespace phase, first return value is true if the phase was changed and second value is an error if operation is not permitted in namespace's present phase

type NamespaceOperation

type NamespaceOperation string
const (
	CreateNamespace     NamespaceOperation = "create"
	ConnectNamespace    NamespaceOperation = "connect"
	DisconnectNamespace NamespaceOperation = "disconnect"
	DeleteNamespace     NamespaceOperation = "delete"
)

Jump to

Keyboard shortcuts

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