Skip to content
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

Expose a new invoke function via gRPC from Worker Executor for incoming HTTP requests #1184

Open
vigoo opened this issue Dec 13, 2024 · 0 comments
Assignees
Milestone

Comments

@vigoo
Copy link
Contributor

vigoo commented Dec 13, 2024

This is the first step in supporting workers implementing the wasi-http incoming-handler interface (https://wa.dev/wasi:http#incoming-handler).

The primary challenge is that this interface takes an incoming-request handle to a host resource, and returns with a outgoing-response handle to a host resource, which is not something we can directly invoke using Golem's existing invokation API.

Instead, as part of this ticket, we define:

  • A gRPC definition of HTTP request->response handler, using gRPC streaming for the request and response body
  • A special invocation mode in worker executor, wrapping the existing one (on the level of invocation.rs) that does the following:
    • Take the request information (coming via gRPC) and set up a host incoming-resource instance
    • Invoke the worker's exported wasi:http/incoming-handler:{handle} function with this resource
    • Take the returned outgoing-response resource and convert it back to the protobuf response structure
  • This new invocation mode needs to be implemented on all layers (Worker, including the invocation loop) and wired to the gRPC handler
  • To make the scope of the task smaller, it is enough for this ticket to NOT do actual request/response body streaming
  • Likely requires changes to the oplog too (to be decided by the implementor), some options:
    • Maybe it is possible to not introduce new invocation start/end entries, but instead use the existing ones, converting the request/response data to Value. Or maybe it is easier to have dedicated new ones. Think of the current ExportedFunctionInvoked, ExportedFunctionCompleted and PendingWorkerInvocation entries.
  • Support this new call in the test DSL
  • Write worker executor test(s) proving this works

With this ticket done we can call worker executor using a representation of a "http request" and get back a representation of a "http response", while the worker itself exports only the wasi-http incoming handler interface.

Follow-up tickets add streaming support and wires this functionality into the worker bridge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants