Skip to content

Split up plugin and stream contexts. - #110

Merged
PiotrSikora merged 2 commits into
proxy-wasm:mainfrom
PiotrSikora:context_create
Oct 22, 2026
Merged

PiotrSikora merged 2 commits into
proxy-wasm:mainfrom
PiotrSikora:context_create

Conversation

@PiotrSikora

Copy link
Copy Markdown
Member

Notable changes:

  1. Removed proxy_on_vm_start callback.
  2. Split plugin lifecycle from stream context lifecycle.
  3. Consolidated proxy_on_done, proxy_on_log, and proxy_on_delete
    into proxy_on_context_finalize.

@PiotrSikora

Copy link
Copy Markdown
Member Author

This is stacked on #91, so please review only the last commit.

@PiotrSikora PiotrSikora linked an issue Sep 24, 2026 that may be closed by this pull request
@PiotrSikora

PiotrSikora commented Oct 1, 2026 •

Copy link
Copy Markdown
Member Author

FWIW, the more I look at this, the more I think that we should implicitly create context as part of "new" callback, which would save one call into VM, and it would match callouts, since we implicitly create new context as part of sending the call.

Change from:

proxy_on_context_create(context_id, context_type, plugin_context_id)
proxy_on_http_request_headers(context_id, end_of_stream)
proxy_on_http_request_body_chunk(context_id, body_size, end_of_stream)
...
proxy_on_context_finalize(context_id)

to:

proxy_on_http_request_headers(context_id, plugin_context_id, end_of_stream)
proxy_on_http_request_body_chunk(context_id, body_size, end_of_stream)
...
proxy_on_http_finalize(context_id)

The main reason for the proxy_on_context_create callback is to bind it to the plugin context, but we also have proxy_context_resume that we'd otherwise have to create for each context.

See previous discussion in #9.

@mpwarres

mpwarres commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Recording discussion elsewhere, we decided that proxy_on_context_create is useful as a "guaranteed" callbacks, since in some integrations (e.g. Service Extensions), customers can choose whether or not to enable/disable headers and body callback events.

Notable changes:
1) Removed `proxy_on_vm_start` callback.
2) Split plugin lifecycle from stream context lifecycle.
3) Consolidated `proxy_on_done`, `proxy_on_log`, and `proxy_on_delete`
   into `proxy_on_context_finalize`.

Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
@PiotrSikora

Copy link
Copy Markdown
Member Author

Unstacked after #91 was merged, no other changes were made.

@PiotrSikora PiotrSikora changed the title Split plugin and stream context lifecycles. Split plugin and stream contexts. Oct 22, 2026
@PiotrSikora PiotrSikora changed the title Split plugin and stream contexts. Split up plugin and stream contexts. Oct 22, 2026
@PiotrSikora
PiotrSikora merged commit bf6919b into proxy-wasm:main Oct 22, 2026
8 checks passed
@PiotrSikora
PiotrSikora deleted the context_create branch October 22, 2026 10:30
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

Successfully merging this pull request may close these issues.

ABI vNEXT: generic vs specialized context functions

2 participants