-
Notifications
You must be signed in to change notification settings - Fork 7
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
Refactor feature/proc #94
Conversation
* Pull wazero.Runtime config out of pkg/process; populate via Fx. * Wrap public client capabilities with high-level API types. * Use capnp refcounting to factor out tracking of release funcs.
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.
I've learnt quite a lot seeing what you did in this refactor! It was refreshing
msg @1 :Text; | ||
exitErr :group { | ||
code @2 :UInt32; | ||
module @3 :Text; |
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.
What does module represent?
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.
Ah, this is the name of the module. It is one of the fields contained in sys.ExitError
, which is returned by calls to exported module functions. (Maybe we should rename to moduleName
?)
return err | ||
} | ||
|
||
ee := state.Err.(*sys.ExitError) |
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.
Just so we are in the same page, will error
be used for when something goes wrong outside the process execution and ExitError
for errors raised during execution? If so I like it
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.
Correct -- returning an error from a capability server's method means "the RPC call failed". The capnp Error
struct means "an application-level error occurred". In the present case, that indeed means the guest code returned an error.
This is exactly equivalent to HTTP, where error
means the network-level request/response failed, and a status code can indicate an error in the application logic. It's just more expressive than returning integer codes.
@mikelsr As warned, this ended up being a pretty large diff.
Changes include:
process.Server
name; let me know what you think).pkg/server
Let me know what you think!
P.S. It might be easier to checkout the
cleanup/proc-lazy-init
branch and just read that directly. The diff is super noisy (though much of it is file renames/deletes). If you decide to do this, running the unit test is probably a good place to start.