Skip to content

Commit 6cf315d

Browse files
ritesh089vados-cosmonic
authored andcommitted
feat(examples): Fixed the exception on link Events in custom component
Signed-off-by: Ritesh Rai <ritesh.rai@aexp.com>
1 parent 67be577 commit 6cf315d

File tree

7 files changed

+12
-9
lines changed

7 files changed

+12
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
keyvalue-inmemory
2-
keyvalue-inmemory.par.gz
2+
keyvalue-inmemory.par.gz
3+
build/*

examples/golang/providers/custom-template/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ wash call custom-template wasmcloud:example/system-info.call
5757
You can deploy this provider, along with a [prebuilt component](../component/) for testing, by deploying the [wadm.yaml](./wadm.yaml) application.
5858

5959
```bash
60+
# Build the component
61+
cd component
62+
wash build
63+
64+
# Return to the provider directory
65+
cd ..
66+
6067
# Launch wasmCloud in the background
6168
wash up -d
6269
# Deploy the application

examples/golang/providers/custom-template/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/wasmCloud/wasmCloud/examples/go/providers/custom-template
33
go 1.22.3
44

55
require (
6-
github.com/wasmCloud/provider-sdk-go v0.0.0-20240605180317-5423f4b7b591
6+
github.com/wasmCloud/provider-sdk-go v0.0.0-20240626135506-00b1fb3dec9e
77
github.com/wrpc/wrpc/go v0.0.0-20240613112243-134a38a3526e
88
)
99

examples/golang/providers/custom-template/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
1212
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
1313
github.com/wasmCloud/provider-sdk-go v0.0.0-20240605180317-5423f4b7b591 h1:B3Vu1XsW9tqhhK4YxAOmY57MRPoeCZVzhFBo69gBoUs=
1414
github.com/wasmCloud/provider-sdk-go v0.0.0-20240605180317-5423f4b7b591/go.mod h1:DZRTpRkX3YluIs+FKcx157XbQa1q4rFRDpxbamZZBc0=
15+
github.com/wasmCloud/provider-sdk-go v0.0.0-20240626135506-00b1fb3dec9e h1:UIK1VDU1hwvGTd4S9pokw/IoY0ChIhYldWB44JnWuD8=
16+
github.com/wasmCloud/provider-sdk-go v0.0.0-20240626135506-00b1fb3dec9e/go.mod h1:DZRTpRkX3YluIs+FKcx157XbQa1q4rFRDpxbamZZBc0=
1517
github.com/wrpc/wrpc/go v0.0.0-20240508154835-d040797e7796 h1:Z/O56d+UBUL6/AfUgGznbR/o+pC2OK9ZtbvGIMNolZ8=
1618
github.com/wrpc/wrpc/go v0.0.0-20240508154835-d040797e7796/go.mod h1:4ODSqZ7VmerRQfX/0l62GzrKSGCiJaPkVBLGJlpIunc=
1719
github.com/wrpc/wrpc/go v0.0.0-20240613112243-134a38a3526e h1:BNQdM1BPIRXHze08bd3R1KPqgPYVKUkuEuLUCGcYW5c=

examples/golang/providers/custom-template/main.go

-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package main
44

55
import (
6-
"fmt"
76
"log"
87
"os"
98
"os/signal"
@@ -86,36 +85,30 @@ func run() error {
8685
}
8786

8887
func handleNewSourceLink(handler *Handler, link provider.InterfaceLinkDefinition) error {
89-
fmt.Println("Handling new source link", "link", link)
9088
handler.linkedTo[link.Target] = link.SourceConfig
9189
return nil
9290
}
9391

9492
func handleNewTargetLink(handler *Handler, link provider.InterfaceLinkDefinition) error {
95-
fmt.Println("Handling new target link", "link", link)
9693
handler.linkedFrom[link.SourceID] = link.TargetConfig
9794
return nil
9895
}
9996

10097
func handleDelSourceLink(handler *Handler, link provider.InterfaceLinkDefinition) error {
101-
fmt.Println("Handling del source link", "link", link)
10298
delete(handler.linkedTo, link.SourceID)
10399
return nil
104100
}
105101

106102
func handleDelTargetLink(handler *Handler, link provider.InterfaceLinkDefinition) error {
107-
fmt.Println("Handling del target link", "link", link)
108103
delete(handler.linkedFrom, link.Target)
109104
return nil
110105
}
111106

112107
func handleHealthCheck(_ *Handler) string {
113-
fmt.Println("Handling health check")
114108
return "provider healthy"
115109
}
116110

117111
func handleShutdown(handler *Handler) error {
118-
fmt.Println("Handling shutdown")
119112
clear(handler.linkedFrom)
120113
clear(handler.linkedTo)
121114
return nil

0 commit comments

Comments
 (0)