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
base: main
Are you sure you want to change the base?
Conversation
370482a
to
ba3b79c
Compare
} | ||
|
||
func (c *capability[I, O, C]) Execute(ctx context.Context, callback chan<- capabilities.CapabilityResponse, request capabilities.CapabilityRequest) error { | ||
tcb := make(chan CapabilityResponse[O]) |
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 tcb
mean?
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 mean obviously it stands for Typed Capability Response :P
} | ||
} | ||
|
||
func NewCapability[I, O, C any](cap Capability[I, O, C]) capabilities.CallbackExecutable { |
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.
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
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.
Yes agreed :) We could use this for observability and logging for example :)
Err error | ||
} | ||
|
||
type CapabilityRequest[I, C any] struct { |
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.
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?
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'd imagine it's the same, capabilities should have a input/config/output schema they abide to.
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.
@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.
No description provided.