Files
mesh-sdk/go/views/handacts.go
T

23 lines
758 B
Go

package views
import "errors"
// HandAct is a hand act a part records before it does it: what is done, why, and the cause and verb that name it.
type HandAct struct {
What, Why, Cause, Verb string
}
// HandActs records a hand act (novox/hq ADR 0565 clause 11) before the part does it; a part gives the one that records
// it through its hand-acts client. An act that is not taken returns an error that says nothing was recorded,
// and the part then does nothing. A nil HandActs records nothing, so a re-read by hand is refused.
type HandActs interface {
RecordHandAct(HandAct) error
}
func recordHandAct(acts HandActs, a HandAct) error {
if acts == nil {
return errors.New("no way to record a hand act is given")
}
return acts.RecordHandAct(a)
}