Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Car ¶
type Car struct { Tire []*Tire Miles float64 Running bool // When the tires were last rotated LastRotation int64 // Default speed value is in yang model file and free's your code // from hardcoded values, even if they are only default values // units milliseconds/mile Speed int // How fast to apply speed. Default it 1s or "miles per second" PollInterval time.Duration // contains filtered or unexported fields }
//////////////////////// C A R - example application
This has nothing to do with FreeCONF, just an example application written in Go. that models a running car that can get flat tires when tires are worn.
func (*Car) OnUpdate ¶
func (c *Car) OnUpdate(l CarListener) Subscription
OnUpdate to listen for car events like start, stop and flat tire
func (*Car) ReplaceTires ¶
func (c *Car) ReplaceTires()
func (*Car) RotateTires ¶
func (c *Car) RotateTires()
type Subscription ¶
type Subscription interface {
Close() error
}
Subscription is handle into a list.List that when closed will automatically remove item from list. Useful for maintaining a set of listeners that can easily remove themselves.
func NewSubscription ¶
func NewSubscription(l *list.List, e *list.Element) Subscription
NewSubscription is used by subscription managers to give a token to caller the can close to unsubscribe to events
type UpdateEvent ¶
type UpdateEvent int
car event types
const ( CarStarted UpdateEvent = iota + 1 CarStopped FlatTire )
func (UpdateEvent) String ¶
func (e UpdateEvent) String() string
Click to show internal directories.
Click to hide internal directories.