Add state caching and invalidation to service type

This required a change in the event system to add an "activity" field.
This is meant to be generic in the case that there is more than one need
for it, but at the moment, allows a poke to tell that it is a poke in
response to an apply that just finished, instead of a regular poke or
backpoke in which all that matters is timestamp updates, because there
wasn't any actual work done (since that state was okay).
This commit is contained in:
James Shubin
2016-01-14 23:22:31 -05:00
parent 935805aeda
commit f7858b8e9b
5 changed files with 46 additions and 18 deletions

View File

@@ -25,14 +25,15 @@ const (
eventStart
eventPause
eventPoke
eventChanged
eventBackPoke
)
type Event struct {
Name eventName
Resp chan bool // channel to send an ack response on, nil to skip
//Wg *sync.WaitGroup // receiver barrier to Wait() for everyone else on
Msg string // some words for fun
Msg string // some words for fun
Activity bool // did something interesting happen?
}
// send a single acknowledgement on the channel if one was requested
@@ -47,3 +48,8 @@ func (event *Event) NACK() {
event.Resp <- false // send NACK
}
}
// get the activity value
func (event *Event) GetActivity() bool {
return event.Activity
}