@@ -27,7 +27,7 @@ const (
2727)
2828
2929type WasmcloudProvider struct {
30- Id string
30+ ID string
3131
3232 context context.Context
3333 cancel context.CancelFunc
@@ -221,7 +221,7 @@ func NewWithHostDataSource(source io.Reader, options ...ProviderHandler) (*Wasmc
221221
222222 ctx , cancel := context .WithCancel (context .Background ())
223223 provider := & WasmcloudProvider {
224- Id : hostData .ProviderKey ,
224+ ID : hostData .ProviderKey ,
225225 Logger : logger ,
226226 RPCClient : wrpc ,
227227 Topics : LatticeTopics (hostData , providerXkey ),
@@ -290,6 +290,7 @@ func (wp *WasmcloudProvider) NatsConnection() *nats.Conn {
290290 return wp .natsConnection
291291}
292292
293+ //nolint:revive
293294func (wp * WasmcloudProvider ) OutgoingRpcClient (target string ) * wrpcnats.Client {
294295 return wrpcnats .NewClient (wp .natsConnection , wrpcnats .WithPrefix (fmt .Sprintf ("%s.%s" , wp .hostData .LatticeRPCPrefix , target )))
295296}
@@ -313,9 +314,9 @@ func (wp *WasmcloudProvider) Start() error {
313314 return err
314315 }
315316
316- wp .Logger .Info ("provider started" , "id" , wp .Id )
317+ wp .Logger .Info ("provider started" , "id" , wp .ID )
317318 <- wp .context .Done ()
318- wp .Logger .Info ("provider exiting" , "id" , wp .Id )
319+ wp .Logger .Info ("provider exiting" , "id" , wp .ID )
319320 return nil
320321}
321322
@@ -345,7 +346,7 @@ func (wp *WasmcloudProvider) Shutdown() error {
345346
346347func (wp * WasmcloudProvider ) subToNats () error {
347348 // ------------------ Subscribe to Health topic --------------------
348- health , err := wp .natsConnection .Subscribe (wp .Topics .LATTICE_HEALTH ,
349+ health , err := wp .natsConnection .Subscribe (wp .Topics .LatticeHealth ,
349350 func (m * nats.Msg ) {
350351 msg := wp .healthMsgFunc ()
351352 hc := HealthCheckResponse {
@@ -365,14 +366,14 @@ func (wp *WasmcloudProvider) subToNats() error {
365366 }
366367 })
367368 if err != nil {
368- wp .Logger .Error ("LATTICE_HEALTH " , slog .Any ("error" , err ))
369+ wp .Logger .Error ("LatticeHealth " , slog .Any ("error" , err ))
369370 return err
370371 }
371372
372- wp .natsSubscriptions [wp .Topics .LATTICE_HEALTH ] = health
373+ wp .natsSubscriptions [wp .Topics .LatticeHealth ] = health
373374
374375 // ------------------ Subscribe to Delete link topic --------------
375- linkDel , err := wp .natsConnection .Subscribe (wp .Topics .LATTICE_LINK_DEL ,
376+ linkDel , err := wp .natsConnection .Subscribe (wp .Topics .LatticeLinkDel ,
376377 func (m * nats.Msg ) {
377378 link := InterfaceLinkDefinition {}
378379 err := json .Unmarshal (m .Data , & link )
@@ -393,10 +394,10 @@ func (wp *WasmcloudProvider) subToNats() error {
393394 return err
394395 }
395396
396- wp .natsSubscriptions [wp .Topics .LATTICE_LINK_DEL ] = linkDel
397+ wp .natsSubscriptions [wp .Topics .LatticeLinkDel ] = linkDel
397398
398399 // ------------------ Subscribe to New link topic --------------
399- linkPut , err := wp .natsConnection .Subscribe (wp .Topics .LATTICE_LINK_PUT ,
400+ linkPut , err := wp .natsConnection .Subscribe (wp .Topics .LatticeLinkPut ,
400401 func (m * nats.Msg ) {
401402 link := linkWithEncryptedSecrets {}
402403 err := json .Unmarshal (m .Data , & link )
@@ -422,10 +423,10 @@ func (wp *WasmcloudProvider) subToNats() error {
422423 return err
423424 }
424425
425- wp .natsSubscriptions [wp .Topics .LATTICE_LINK_PUT ] = linkPut
426+ wp .natsSubscriptions [wp .Topics .LatticeLinkPut ] = linkPut
426427
427428 // ------------------ Subscribe to Shutdown topic ------------------
428- shutdown , err := wp .natsConnection .Subscribe (wp .Topics .LATTICE_SHUTDOWN ,
429+ shutdown , err := wp .natsConnection .Subscribe (wp .Topics .LatticeShutdown ,
429430 func (m * nats.Msg ) {
430431 err := wp .shutdownFunc ()
431432 if err != nil {
@@ -447,11 +448,11 @@ func (wp *WasmcloudProvider) subToNats() error {
447448 wp .cancel ()
448449 })
449450 if err != nil {
450- wp .Logger .Error ("LATTICE_SHUTDOWN " , slog .Any ("error" , err ))
451+ wp .Logger .Error ("LatticeShutdown " , slog .Any ("error" , err ))
451452 return err
452453 }
453454
454- wp .natsSubscriptions [wp .Topics .LATTICE_SHUTDOWN ] = shutdown
455+ wp .natsSubscriptions [wp .Topics .LatticeShutdown ] = shutdown
455456 return nil
456457}
457458
@@ -506,14 +507,14 @@ func (wp *WasmcloudProvider) putLink(l InterfaceLinkDefinition) error {
506507
507508 wp .lock .Lock ()
508509 defer wp .lock .Unlock ()
509- if l .SourceID == wp .Id {
510+ if l .SourceID == wp .ID {
510511 err := wp .putSourceLinkFunc (l )
511512 if err != nil {
512513 return err
513514 }
514515
515516 wp .sourceLinks [l .Target ] = l
516- } else if l .Target == wp .Id {
517+ } else if l .Target == wp .ID {
517518 err := wp .putTargetLinkFunc (l )
518519 if err != nil {
519520 return err
@@ -534,9 +535,9 @@ func (wp *WasmcloudProvider) updateProviderLinkMap(l InterfaceLinkDefinition) er
534535 }
535536 wp .lock .Lock ()
536537 defer wp .lock .Unlock ()
537- if l .SourceID == wp .Id {
538+ if l .SourceID == wp .ID {
538539 wp .sourceLinks [l .Target ] = l
539- } else if l .Target == wp .Id {
540+ } else if l .Target == wp .ID {
540541 wp .targetLinks [l .SourceID ] = l
541542 } else {
542543 wp .Logger .Info ("received link that isn't for this provider, ignoring" , "link" , l )
@@ -547,14 +548,14 @@ func (wp *WasmcloudProvider) updateProviderLinkMap(l InterfaceLinkDefinition) er
547548func (wp * WasmcloudProvider ) deleteLink (l InterfaceLinkDefinition ) error {
548549 wp .lock .Lock ()
549550 defer wp .lock .Unlock ()
550- if l .SourceID == wp .Id {
551+ if l .SourceID == wp .ID {
551552 err := wp .delSourceLinkFunc (l )
552553 if err != nil {
553554 return err
554555 }
555556
556557 delete (wp .sourceLinks , l .Target )
557- } else if l .Target == wp .Id {
558+ } else if l .Target == wp .ID {
558559 err := wp .delTargetLinkFunc (l )
559560 if err != nil {
560561 return err
@@ -568,14 +569,14 @@ func (wp *WasmcloudProvider) deleteLink(l InterfaceLinkDefinition) error {
568569 return nil
569570}
570571
571- func (wp * WasmcloudProvider ) isLinked (sourceId string , target string ) bool {
572+ func (wp * WasmcloudProvider ) isLinked (sourceID string , target string ) bool {
572573 wp .lock .Lock ()
573574 defer wp .lock .Unlock ()
574- if sourceId == wp .Id {
575+ if sourceID == wp .ID {
575576 _ , exists := wp .sourceLinks [target ]
576577 return exists
577- } else if target == wp .Id {
578- _ , exists := wp .targetLinks [sourceId ]
578+ } else if target == wp .ID {
579+ _ , exists := wp .targetLinks [sourceID ]
579580 return exists
580581 }
581582 return false
0 commit comments