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

[WIP] Typed capability API #462

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

cedric-cordenier
Copy link
Contributor

No description provided.

}

func (c *capability[I, O, C]) Execute(ctx context.Context, callback chan<- capabilities.CapabilityResponse, request capabilities.CapabilityRequest) error {
tcb := make(chan CapabilityResponse[O])
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does tcb mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean obviously it stands for Typed Capability Response :P

}
}

func NewCapability[I, O, C any](cap Capability[I, O, C]) capabilities.CallbackExecutable {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks great, and is the direction I wanted to take the Validation API efforts to :)
What we're building represents a RPC framework of sorts.

I'd imagine there's a lot of value to be had by allowing the user to inject middlewares that are called during request/response lifecycle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes agreed :) We could use this for observability and logging for example :)

Err error
}

type CapabilityRequest[I, C any] struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

How do those work in a remote setting? Does the receiver always know what type to expect or is there some type info encoded too?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd imagine it's the same, capabilities should have a input/config/output schema they abide to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bolekk This is purely a client-side feature (i.e. inside the capability), anything accessing the capability (either via the Remote API or via the workflow engine would continue to do so via the lower-level, values-based API.

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.

None yet

3 participants