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

[CAPPL-99] capability type assertion #15185

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions core/capabilities/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,14 @@ func (w *launcher) exposeCapabilities(ctx context.Context, myPeerID p2ptypes.Pee
switch capability.CapabilityType {
case capabilities.CapabilityTypeTrigger:
newTriggerPublisher := func(cap capabilities.BaseCapability, info capabilities.CapabilityInfo) (remotetypes.ReceiverService, error) {
triggerCapability, ok := (cap).(capabilities.TriggerCapability)
if !ok {
return nil, errors.New("capability does not implement TriggerCapability")
}

publisher := remote.NewTriggerPublisher(
capabilityConfig.RemoteTriggerConfig,
cap.(capabilities.TriggerCapability),
triggerCapability,
info,
don.DON,
idsToDONs,
Expand All @@ -419,10 +424,15 @@ func (w *launcher) exposeCapabilities(ctx context.Context, myPeerID p2ptypes.Pee
w.lggr.Warn("no remote client configured for capability type consensus, skipping configuration")
case capabilities.CapabilityTypeTarget:
newTargetServer := func(cap capabilities.BaseCapability, info capabilities.CapabilityInfo) (remotetypes.ReceiverService, error) {
targetCapability, ok := (cap).(capabilities.TargetCapability)
if !ok {
return nil, errors.New("capability does not implement TargetCapability")
}

return target.NewServer(
capabilityConfig.RemoteTargetConfig,
myPeerID,
cap.(capabilities.TargetCapability),
targetCapability,
info,
don.DON,
idsToDONs,
Expand Down
Loading
Loading