engine: Fix up some send/recv corner cases
Initially I wasn't 100% clear or decided on the send/recv semantics. After some experimenting, I think this is much closer to what we want. Nothing should break or regress here, this only enables more possibilities.
This commit is contained in:
@@ -56,6 +56,28 @@ type SendableRes interface {
|
||||
|
||||
// Sent returns the most recently sent data. This is used by the engine.
|
||||
Sent() interface{}
|
||||
|
||||
// SendActive let's the resource know if it must send a value. This is
|
||||
// usually called during CheckApply, but it's probably safe to check it
|
||||
// during Init as well.
|
||||
// XXX: Not doing this for now. If a send/recv edge wasn't initially on,
|
||||
// and the sender ran CheckApply, but didn't cache the value to send,
|
||||
// and then the edge flipped on, we'd have to error. Better to always
|
||||
// generate the cache, and only consider adding this if we have a more
|
||||
// important privacy or performance situation that requires it.
|
||||
//SendActive() bool
|
||||
|
||||
// SendSetActive is used by the compiler to store the "SendActive" bool
|
||||
// so that it will later know if it will need to send or not. Only the
|
||||
// engine should call this function.
|
||||
// TODO: We could instead pass in the various edges we will be sending,
|
||||
// and store a map of those for the resource to know more precisely.
|
||||
// XXX: Not doing this for now. If a send/recv edge wasn't initially on,
|
||||
// and the sender ran CheckApply, but didn't cache the value to send,
|
||||
// and then the edge flipped on, we'd have to error. Better to always
|
||||
// generate the cache, and only consider adding this if we have a more
|
||||
// important privacy or performance situation that requires it.
|
||||
//SendSetActive(bool)
|
||||
}
|
||||
|
||||
// RecvableRes is the interface a resource must implement to support receiving
|
||||
|
||||
Reference in New Issue
Block a user