resources: timer: Polish the timer resource

We should probably use this more correct data type which now matches
what is used by the Poll metaparam.
This commit is contained in:
James Shubin
2016-12-23 23:34:27 -05:00
parent b921aabbed
commit ecc4aa09d3

View File

@@ -32,7 +32,7 @@ func init() {
// TimerRes is a timer resource for time based events. // TimerRes is a timer resource for time based events.
type TimerRes struct { type TimerRes struct {
BaseRes `yaml:",inline"` BaseRes `yaml:",inline"`
Interval int `yaml:"interval"` // Interval : Interval between runs Interval uint32 `yaml:"interval"` // Interval : Interval between runs
ticker *time.Ticker ticker *time.Ticker
} }
@@ -44,7 +44,7 @@ type TimerUID struct {
} }
// NewTimerRes is a constructor for this resource. It also calls Init() for you. // NewTimerRes is a constructor for this resource. It also calls Init() for you.
func NewTimerRes(name string, interval int) (*TimerRes, error) { func NewTimerRes(name string, interval uint32) (*TimerRes, error) {
obj := &TimerRes{ obj := &TimerRes{
BaseRes: BaseRes{ BaseRes: BaseRes{
Name: name, Name: name,
@@ -60,9 +60,7 @@ func (obj *TimerRes) Init() error {
return obj.BaseRes.Init() // call base init, b/c we're overrriding return obj.BaseRes.Init() // call base init, b/c we're overrriding
} }
// Validate the params that are passed to TimerRes // Validate the params that are passed to TimerRes.
// Currently we are getting only an interval in seconds
// which gets validated by go compiler
func (obj *TimerRes) Validate() error { func (obj *TimerRes) Validate() error {
return nil return nil
} }