Documentation ¶
Index ¶
- func Init() error
- type Controller
- type ControllerConfig
- type DefaultController
- func (ctl *DefaultController) CreatePolicy(newPolicy models.ReplicationPolicy) (int64, error)
- func (ctl *DefaultController) GetPolicies(query models.QueryParameter) (*models.ReplicationPolicyQueryResult, error)
- func (ctl *DefaultController) GetPolicy(policyID int64) (models.ReplicationPolicy, error)
- func (ctl *DefaultController) Init() error
- func (ctl *DefaultController) RemovePolicy(policyID int64) error
- func (ctl *DefaultController) Replicate(policyID int64, metadata ...map[string]interface{}) error
- func (ctl *DefaultController) UpdatePolicy(updatedPolicy models.ReplicationPolicy) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Controller ¶
type Controller interface { policy.Manager Init() error Replicate(policyID int64, metadata ...map[string]interface{}) error }
Controller defines the methods that a replicatoin controllter should implement
var (
GlobalController Controller
)
Keep controller as singleton instance
type ControllerConfig ¶
type ControllerConfig struct { // The capacity of the cache storing enabled triggers CacheCapacity int }
ControllerConfig includes related configurations required by the controller
type DefaultController ¶
type DefaultController struct {
// contains filtered or unexported fields
}
DefaultController is core module to cordinate and control the overall workflow of the replication modules.
func NewDefaultController ¶
func NewDefaultController(cfg ControllerConfig) *DefaultController
NewDefaultController is the constructor of DefaultController.
func (*DefaultController) CreatePolicy ¶
func (ctl *DefaultController) CreatePolicy(newPolicy models.ReplicationPolicy) (int64, error)
CreatePolicy is used to create a new policy and enable it if necessary
func (*DefaultController) GetPolicies ¶
func (ctl *DefaultController) GetPolicies(query models.QueryParameter) (*models.ReplicationPolicyQueryResult, error)
GetPolicies is delegation of GetPoliciemodels.ReplicationPolicy{}s of Policy.Manager
func (*DefaultController) GetPolicy ¶
func (ctl *DefaultController) GetPolicy(policyID int64) (models.ReplicationPolicy, error)
GetPolicy is delegation of GetPolicy of Policy.Manager
func (*DefaultController) Init ¶
func (ctl *DefaultController) Init() error
Init will initialize the controller and the sub components
func (*DefaultController) RemovePolicy ¶
func (ctl *DefaultController) RemovePolicy(policyID int64) error
RemovePolicy will remove the specified policy and clean the related settings
func (*DefaultController) Replicate ¶
func (ctl *DefaultController) Replicate(policyID int64, metadata ...map[string]interface{}) error
Replicate starts one replication defined in the specified policy; Can be launched by the API layer and related triggers.
func (*DefaultController) UpdatePolicy ¶
func (ctl *DefaultController) UpdatePolicy(updatedPolicy models.ReplicationPolicy) error
UpdatePolicy will update the policy with new content. Parameter updatedPolicy must have the ID of the updated policy.