Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSync ¶ added in v0.1.13
func DefaultSync(store entitystore.EntityStore, entityType reflect.Type, organizationID string, resyncPeriod time.Duration, filter entitystore.Filter) ([]entitystore.Entity, error)
DefaultSync simply returns a list of entities in non-READY state which have been modified since the resync period.
Types ¶
type Controller ¶
type Controller interface {
Start()
Shutdown()
Watcher() Watcher
AddEntityHandler(h EntityHandler)
}
Controller defines an interface for a generic controller
func NewController ¶
func NewController(options Options) Controller
NewController creates a new controller
type DefaultController ¶
type DefaultController struct {
// contains filtered or unexported fields
}
DefaultController defines a struct for a generic controller
func (*DefaultController) AddEntityHandler ¶
func (dc *DefaultController) AddEntityHandler(h EntityHandler)
AddEntityHandler adds entity handlers
func (*DefaultController) Shutdown ¶
func (dc *DefaultController) Shutdown()
Shutdown stops the controller loop
func (*DefaultController) Start ¶
func (dc *DefaultController) Start()
Start starts the controller watch loop
func (*DefaultController) Watcher ¶
func (dc *DefaultController) Watcher() Watcher
Watcher returns a watcher channel for the controller
type EntityHandler ¶
type EntityHandler interface {
Type() reflect.Type
Add(obj entitystore.Entity) error
Update(obj entitystore.Entity) error
Delete(obj entitystore.Entity) error
Error(obj entitystore.Entity) error
// Sync returns a list of entities which to process. This method should call out and determine the actual state
// of entities.
Sync(organizationID string, resyncPeriod time.Duration) ([]entitystore.Entity, error)
}
EntityHandler define an interface for entity operations of a generic controller
Click to show internal directories.
Click to hide internal directories.