3 ms·
Looks like you are still not implementing the signature of a Controller, which as follows: Controller *interface* boot[*itemIs* Item, *signedIs* Sig
by ProfHewitt 7y ago
Looks like you are still not implementing the signature of a Controller, which as follows:
Controller *interface*
boot[*itemIs* Item, *signedIs* Signed] → TerminationReport
// boot request with an item and signed returns
// a termination report from the boot request
shutDown → Void // shut down request returns Void
A boot request checks the item which is a Package with code and packageVersion and then runs the code. The boot request returns a termination report that results from running the code.
However, when the boot request is still operating, the controller might receive a shutDown request, which will cause the cancellation of the running code that will caught within the run request and turned into a termination report.
Note that there is no timing error in the Actor implementation because, a shutDown request cannot be received until code.run has released the region of mutual exclusion.
- deleted 7y ago[deleted]
- toast0 7y agoOK, so this isn't really {become, F}, this is {run, F}. The function F, is expected to return results and terminates, so it is no longer running (but, it could have spawned a process or otherwise changed the world state; Erlang is generous with respect to side effects) I don't really understand the version number means in this case? You can only run functions with the same or greater versions than had previously been run? I think you're somehow asking for this to be both synchronous, in the sense that the result of running the function is returned directly and asynchronous in that you'd like to be able to cancel it. If you want the return directly, I can't also have previously returned a cancellation id. If you just want to run a function, and get the results back, that's not that hard; but before I write the code for that, I want to really be sure what you're asking for.
- ProfHewitt 7y agoWith respect to your question: "I don't really understand the version number means in this case?" An item can be booted only if its version number has not regressed in to prevent replay attacks. There are no cancellation ids in the Actor implementation, however a cancellation exception can be thrown when an activity is cancelled.