Documentation ¶
Overview ¶
Package eventc eventc ...
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Change *sfs.ReleaseEventMetaV1 Instance *sfs.InstanceSpec CursorID uint32 }
Event defines the event details.
type Handler ¶
type Handler struct { // GetMatchedRelease get the specified app instance's current release id. // Note: this function's match pipeline should not use cache data, GetMatchedRelease func(kt *kit.Kit, meta *btyp.AppInstanceMeta) (uint32, error) }
Handler all the call back handles, used to handle schedule jobs.
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver is defined for the subscriber to control its working state and receive the event messages.
func InitReceiver ¶
func InitReceiver(notify func(event *Event, sn uint64) bool, closeWatch context.CancelFunc) *Receiver
InitReceiver initial a new receiver instance.
func (*Receiver) CloseWatch ¶
func (r *Receiver) CloseWatch()
CloseWatch close sidecar and feed server watch stream.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler works at all the events handling jobs. 1. it accepts subscribe from sidecar and unsubscribe when the sidecar close the connection. 2. it sends events to all the subscribers and will retry to send event if it fails.
func NewScheduler ¶
NewScheduler create a new scheduler instance. And, scheduler start accept subscribe and unsubscribe operations, but still not works for events processing, which means scheduler do not match the subscribed instance's release.
func (*Scheduler) Subscribe ¶
func (sch *Scheduler) Subscribe(currentRelease uint32, currentCursorID uint32, subSpec *SubscribeSpec) (uint64, error)
Subscribe register an app instance to subscribe the release event for it. it returns a serial number(as is sn) which represent this app instance's watch identity id.
type SubscribeSpec ¶
type SubscribeSpec struct { InstSpec *sfs.InstanceSpec Receiver *Receiver }
SubscribeSpec defines the metadata to watch the event.
func (SubscribeSpec) Validate ¶
func (s SubscribeSpec) Validate() error
Validate the SubscribeSpec is valid or not.