Documentation ¶
Index ¶
- Variables
- func PerformClusterOperation(cluster *dbapi.ConnectorCluster, operation ClusterOperation, ...) (updated bool, err *errors.ServiceError)
- func PerformConnectorOperation(namespace *dbapi.ConnectorNamespace, connector *dbapi.Connector, ...) (updated bool, err *errors.ServiceError)
- func PerformNamespaceOperation(cluster *dbapi.ConnectorCluster, namespace *dbapi.ConnectorNamespace, ...) (updated bool, err *errors.ServiceError)
- type ClusterFSM
- type ClusterOperation
- type ConnectorFSM
- type ConnectorOperation
- type NamespaceFSM
- type NamespaceOperation
Constants ¶
This section is empty.
Variables ¶
var ConnectorStartingPhase = map[ConnectorOperation]dbapi.ConnectorStatusPhase{ CreateConnector: dbapi.ConnectorStatusPhaseAssigning, AssignConnector: dbapi.ConnectorStatusPhaseAssigning, UnassignConnector: dbapi.ConnectorStatusPhaseDeleting, RestartConnector: dbapi.ConnectorStatusPhaseAssigned, StopConnector: dbapi.ConnectorStatusPhaseAssigned, UpdateConnector: dbapi.ConnectorStatusPhaseUpdating, DeleteConnector: dbapi.ConnectorStatusPhaseDeleting, }
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 ¶
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" )