Skip to content

reexec: add context-aware entrypoints and Dispatch#218

Open
thaJeztah wants to merge 1 commit into
moby:mainfrom
thaJeztah:contextualize
Open

reexec: add context-aware entrypoints and Dispatch#218
thaJeztah wants to merge 1 commit into
moby:mainfrom
thaJeztah:contextualize

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah commented Apr 17, 2026

Follow-up to 7aa8514; allow entrypoints to be invoked with a context and to return an error;

  • Add RegisterContext to register context-aware entrypoints.
  • Add Dispatch and DispatchContext, both returning (handled, error).
  • Init is kept for backward compatibility or cases where context or errors don't have to be handled.

Follow-up to 7aa8514; allow entrypoints
to be invoked with a context and to return an error;

- Add RegisterContext to register context-aware entrypoints.
- Add Dispatch and DispatchContext, both returning (handled, error).
- Init is kept for backward compatibility or cases where context
  or errors don't have to be handled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Comment thread reexec/reexec_test.go
Comment thread reexec/reexec.go
return dispatch(context.Background())
}

// DispatchContext is like [Dispatch] but includes a context.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a new function, maybe

  • remove context-less version entirely;
  • rename the context-ful version to Dispatch.

Comment thread reexec/reexec_test.go

if ok, err := reexec.DispatchContext(context.Background()); ok {
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "entrypoint failed:", err)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is _, _ = really needed here?

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.

2 participants