New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actors. #129
Actors. #129
Conversation
Benchmark for c5d627aClick to view benchmark
|
Benchmark for 0d901c6Click to view benchmark
|
Benchmark for 21ca0b3Click to view benchmark
|
Benchmark for 12861fdClick to view benchmark
|
crates/motoko/src/lib/vm_types.rs
Outdated
fn counts<'a>(&'a mut self) -> &'a mut Counts; | ||
|
||
fn alloc(&mut self, value: impl Into<Value_>) -> Pointer { | ||
self.store().alloc(value) | ||
} | ||
|
||
fn create(&mut self, _name: Option<Id>, _actor: Actor) -> Result<Value_, Interruption> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create an actor (value) and add it to the VM...
To be useful for Motoko Dev Sever, maybe it should accept a string (read from a file by the caller) and some other stuff, including the canister ID that dfx knows about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW -- the name create
is somewhat arbitrary, but has two nice properties now:
- separate verb from
alloc
, to distinguish it from that case. - same verb as the IC reference spec, for the act of "creating a canister."
Done(Value_), | ||
Interruption(Interruption), | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signal
was going to grow to capture errors from I/O.
Except now with the Motoko Dev Server, I am now expecting network I/O to happen outside of the VM, and for this traffic to selectively affect the VM from its public API for Core
, which will grow to accommodate the Dev Server.
Accordingly, I am dropping the Signal
concept here, and related code.
Benchmark for ee484b9Click to view benchmark
|
pub enum ActorId { | ||
/// Actor is identified by a local name in the Agent program that creates it. | ||
Local(Id), | ||
// to do -- case: canister ID and canister alias pair from dfx.json. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rvanasa ActorId
could have a variant called DfxCanister
or whatever name seems appropriate given what identifier you choose to use.
As you've suggested previously, perhaps it's simplest to just use the "canister alias" dfx concept that we've discussed many times now as the identifier for the DfxCanister
case of ActorId
? (and eschew having the replica-created canister id as part of that id, e.g., as a pair.)
If so, perhaps we can instead put that extra ID info into the actor as associated data, when it's available.
Continues #126, implementing Actors.
This test demonstrates how to reproduce the following steps, all of which now work:
Counter
.Counter
a message (calling a method)Counter
's methods execute with its internal state, and variables.Counter
by re-using the same name later in the script (proof of concept form of upgrade, for unit testing here)