Skip to content

Commit

Permalink
feat: Integrate template to servicerunner
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward2k committed Apr 5, 2024
1 parent 317ed4b commit bbb7acd
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 7 deletions.
15 changes: 12 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ module vu/ase/ENTERYOURMODULENAMEHERE
go 1.21.6

require (
github.com/VU-ASE/pkg-CommunicationDefinitions/v2 v2.12.0
github.com/VU-ASE/pkg-ServiceRunner/v2 v2.10.0
github.com/rs/zerolog v1.31.0
)

require (
github.com/go-yaml/yaml v2.1.0+incompatible // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/rs/zerolog v1.31.0 // indirect
golang.org/x/sys v0.12.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pebbe/zmq4 v1.2.10 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
)
32 changes: 30 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
github.com/VU-ASE/pkg-CommunicationDefinitions/v2 v2.12.0 h1:Z1gjRXjem6oQKr9oUn0M3DDwolpWYU7cPKSjMjoHOnY=
github.com/VU-ASE/pkg-CommunicationDefinitions/v2 v2.12.0/go.mod h1:S9XOWhpZzLZDBLwetUjBhHnldqBXIIcBkKA2l/fQnRE=
github.com/VU-ASE/pkg-ServiceRunner/v2 v2.10.0 h1:8hpc6mNsrO4bVFWBgF90c6gXpqeXtj4oel+p37lU8Cc=
github.com/VU-ASE/pkg-ServiceRunner/v2 v2.10.0/go.mod h1:YwBjw7b7rRdsDPNIuyWiNoNkxtZyFrD5IhCSTOBkGDQ=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o=
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pebbe/zmq4 v1.2.10 h1:wQkqRZ3CZeABIeidr3e8uQZMMH5YAykA/WN0L5zkd1c=
github.com/pebbe/zmq4 v1.2.10/go.mod h1:nqnPueOapVhE2wItZ0uOErngczsJdLOGkebMxaO8r48=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
16 changes: 16 additions & 0 deletions service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Service definition
name: ChangeThisRepoName
description: template-GoModule

# No dependencies
dependencies: []

# No outputs (You'll probably want to update this or `dependencies`)
outputs: []

# Runtime options
options:
- name: example_option
type: int # Can be int, float, string, bool
mutable: true # Can be changed at runtime
default: 1 # Default value
26 changes: 24 additions & 2 deletions src/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
package main

import "github.com/rs/zerolog/log"
import (
pb_systemmanager_messages "github.com/VU-ASE/pkg-CommunicationDefinitions/v2/packages/go/systemmanager"
servicerunner "github.com/VU-ASE/pkg-ServiceRunner/v2/src"

"github.com/rs/zerolog/log"
)

func run(
service servicerunner.ResolvedService,
sysMan servicerunner.SystemManagerInfo,
initialTuning *pb_systemmanager_messages.TuningState) error {

log.Info().Str("Planet", "Earth").Msg("Hello world")

//TODO: Implement the service logic here. Likely this will involve

return nil
}

func onTuningState(newtuning *pb_systemmanager_messages.TuningState) {
log.Info().Str("Value", newtuning.String()).Msg("Received tuning state from system manager")
//TODO: Update this service based on the new tuning state
}

func main() {
log.Info().Str("planet", "earth").Msg("Hello World!")
servicerunner.Run(run, onTuningState, false)
}

0 comments on commit bbb7acd

Please sign in to comment.