forked from wasmCloud/provider-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#10): collecting and sending failed links back to cloud provider…
… via server)
- Loading branch information
Showing
4 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/wasmCloud/provider-sdk-go" | ||
"log" | ||
) | ||
|
||
func (p *Provider) establishSourceLink(link provider.InterfaceLinkDefinition) error { | ||
if _, exists := p.sourceLinks[link.Target]; exists { | ||
log.Println("Source link already exists, ignoring duplicate", link) | ||
return nil | ||
} | ||
|
||
if err := p.validateSourceLink(link); err != nil { | ||
return err | ||
} | ||
|
||
p.sourceLinks[link.Target] = link | ||
return nil | ||
} | ||
|
||
func (p *Provider) establishTargetLink(link provider.InterfaceLinkDefinition) error { | ||
if _, exists := p.targetLinks[link.SourceID]; exists { | ||
log.Println("Target link already exists, ignoring duplicate", link) | ||
return nil | ||
} | ||
|
||
if err := p.validateTargetLink(link); err != nil { | ||
return err | ||
} | ||
|
||
p.targetLinks[link.SourceID] = link | ||
return nil | ||
} | ||
|
||
func (p *Provider) validateSourceLink(link provider.InterfaceLinkDefinition) error { | ||
// TODO: Add validation checks | ||
return nil | ||
} | ||
|
||
func (p *Provider) validateTargetLink(link provider.InterfaceLinkDefinition) error { | ||
// TODO: Add validation checks | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters