Open comcast-jonm opened 10 years ago
In the course of hacking up a prototype 'tagged' interface, I came up with a workaround for this problem. It is similar to the first suggestion Jon suggested, in that it passes back the handler function return value, but does so by adding a Promise to the request (in the same way as the tag object) and using the return value to complete the Promise. It works, and is easy to understand, but might be violating the actor model by short-circuiting a value directly rather than sending a message.
[On further thought I think this is a dumb idea, not only for the argument raised above but also because I'm not sure Akka wants you to pass 'complex' objects like Promise
around]
A quick eyeball of the code suggests that implementing Jon's first suggestion might require nothing more than deleting the line where 'SiriusResult.none' is sent back by the PaxosStateHandler. Is there any reason not to just do that?
Currently, when the
PaxosStateBridge
receives a Paxos decision, it acks the update back to the originating client with aSiriusResult.none()
before that update has been persisted or applied to the brain via theRequestHandler
. This means there is no way to tell if an exception was thrown while trying to apply it, and there is no way to have a return value from theRequestHandler
'senqueuePut
orenqueueDelete
methods.Possible solutions:
RequestHandler
, and reply with the return value ofhandlePut
/handleDelete
RequestHandler
interface so thatenqueuePut
/enqueueDelete
return aFuture<Unit>
, to make it clear there is no information being propagated out