Skip to content

Commit 81f01e4

Browse files
committed
Semi-finish exec call signature implementation #133
1 parent fd5caa9 commit 81f01e4

File tree

13 files changed

+421
-220
lines changed

13 files changed

+421
-220
lines changed

api/process.capnp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ using Tools = import "/experiments/tools.capnp";
1111
interface Executor {
1212
# Executor has the ability to create and run WASM processes given the
1313
# WASM bytecode.
14-
exec @0 (bytecode :Data, caps :List(Capability)) -> (process :Process);
14+
exec @0 (bytecode :Data, spid :Data, caps :List(Capability)) -> (process :Process);
1515
# Exec creates an runs a process from the provided bytecode. Optionally, a
1616
# capability can be passed through the `cap` parameter. This capability will
1717
# be available at the process inbox.
1818
#
1919
# The Process capability is associated to the created process.
20-
execFromCache @1 (md5sum :Data, caps :List(Capability)) -> (process :Process);
20+
execFromCache @1 (md5sum :Data, spid :Data, caps :List(Capability)) -> (process :Process);
2121
# Same as Exec, but the bytecode is directly from the BytecodeRegistry.
2222
# Provides a significant performance improvement for medium to large
2323
# WASM streams.

api/process/process.capnp.go

Lines changed: 127 additions & 100 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/csp/executor.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ func (ex Executor) Release() {
1919
capnp.Client(ex).Release()
2020
}
2121

22-
func (ex Executor) Exec(ctx context.Context, src []byte, caps ...capnp.Client) (Proc, capnp.ReleaseFunc) {
22+
func (ex Executor) Exec(ctx context.Context, src []byte, spid []byte, caps ...capnp.Client) (Proc, capnp.ReleaseFunc) {
2323
f, release := api.Executor(ex).Exec(ctx, func(ps api.Executor_exec_Params) error {
2424
if err := ps.SetBytecode(src); err != nil {
2525
return err
2626
}
27+
if spid != nil {
28+
if err := ps.SetSpid(spid); err != nil {
29+
return err
30+
}
31+
}
2732
if caps == nil {
2833
return nil
2934
}
@@ -37,11 +42,16 @@ func (ex Executor) Exec(ctx context.Context, src []byte, caps ...capnp.Client) (
3742
return Proc(f.Process()), release
3843
}
3944

40-
func (ex Executor) ExecFromCache(ctx context.Context, md5sum []byte, caps ...capnp.Client) (Proc, capnp.ReleaseFunc) {
45+
func (ex Executor) ExecFromCache(ctx context.Context, md5sum []byte, spid []byte, caps ...capnp.Client) (Proc, capnp.ReleaseFunc) {
4146
f, release := api.Executor(ex).ExecFromCache(ctx, func(ps api.Executor_execFromCache_Params) error {
4247
if err := ps.SetMd5sum(md5sum); err != nil {
4348
return err
4449
}
50+
if spid != nil {
51+
if err := ps.SetSpid(spid); err != nil {
52+
return err
53+
}
54+
}
4555
if caps == nil {
4656
return nil
4757
}

0 commit comments

Comments
 (0)