Documentation ¶
Overview ¶
Package statusbus collects and dispatches object rid status changes
It allows:
Post object rid status Get object rid status
Index ¶
- Variables
- func WithContext(ctx context.Context, p naming.Path) (context.Context, func())
- type ObjT
- func (t *ObjT) First(rid string) status.T
- func (t *ObjT) Get(rid string) status.T
- func (t *ObjT) Pending(rid string)
- func (t *ObjT) Post(rid string, state status.T, pending bool)
- func (t *ObjT) Register(rid string, hook func(status.T)) uuid.UUID
- func (t *ObjT) Unregister(rid string, u uuid.UUID)
- func (t *ObjT) Wait(rid string, timeout time.Duration) status.T
- type T
- func (t *T) First(p naming.Path, rid string) status.T
- func (t *T) Get(p naming.Path, rid string) status.T
- func (t *T) Pending(p naming.Path, rid string)
- func (t *T) Post(p naming.Path, rid string, state status.T, pending bool)
- func (t *T) Register(p naming.Path, rid string, hook func(status.T)) uuid.UUID
- func (t *T) Start()
- func (t *T) Stop()
- func (t *T) Unregister(p naming.Path, rid string, u uuid.UUID)
- func (t *T) Wait(p naming.Path, rid string, timeout time.Duration) status.T
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorStarted = errors.New("server already started") ErrorNeedStart = errors.New("server not started") )
Functions ¶
Types ¶
type ObjT ¶
type ObjT struct {
// contains filtered or unexported fields
}
func FromContext ¶
func NewObjectBus ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
func (*T) Get ¶
Get retrieve an object rid status
returns status.Undef if no object rid is not found
Example:
p := path.Path{Name:"foo",Namespace: "root", Kind: kind.Svc} bus.Post(p, "app#1", status.Up) bus.Post(p, "app#2", status.Down) bus.Get(p, "app#1") // returns status.Up bus.Get(p, "app#2") // returns status.Down bus.Get(p, "app#99") // returns status.Undef bus.Get(path.Path{}, "app#1") // returns status.Undef
func (*T) Post ¶
Post push a new object rid status to status bus
bus.Post(naming.Path{Name:"foo",Namespace: "root", Kind: kind.Svc},
"app#1", status.Down))
Click to show internal directories.
Click to hide internal directories.