Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSync ¶ added in v0.1.13
func DefaultSync(ctx context.Context, store entitystore.EntityStore, entityType reflect.Type, 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(ctx context.Context, obj entitystore.Entity) error Update(ctx context.Context, obj entitystore.Entity) error Delete(ctx context.Context, obj entitystore.Entity) error Error(ctx context.Context, 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(ctx context.Context, resyncPeriod time.Duration) ([]entitystore.Entity, error) }
EntityHandler define an interface for entity operations of a generic controller
type Options ¶
type Options struct { ServiceName string ResyncPeriod time.Duration Workers int Driver zookeeper.Driver ZookeeperLocation string }
Options defines controller configuration
type WatchEvent ¶ added in v0.1.15
WatchEvent captures entity together with the associated context
Click to show internal directories.
Click to hide internal directories.