diff --git a/.gitignore b/.gitignore index 9e23ac2..9535c09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /dist -/uploads \ No newline at end of file +/uploads +/default.etcd \ No newline at end of file diff --git a/go.mod b/go.mod index 43b8ee5..7044a73 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module git.solsynth.dev/hypernet/nexus -go 1.21.6 +go 1.22 -toolchain go1.22.1 +toolchain go1.23.2 require ( github.com/fatih/color v1.17.0 @@ -17,6 +17,7 @@ require ( github.com/rs/zerolog v1.31.0 github.com/samber/lo v1.39.0 github.com/spf13/viper v1.18.2 + go.etcd.io/etcd/client/v3 v3.5.16 google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 gorm.io/datatypes v1.2.0 @@ -27,6 +28,8 @@ require ( require ( github.com/andybalholm/brotli v1.1.0 // indirect github.com/armon/go-metrics v0.4.1 // indirect + github.com/coreos/go-semver v0.3.0 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/fasthttp/websocket v1.5.8 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect @@ -34,6 +37,8 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-sql-driver/mysql v1.7.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/consul/api v1.29.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -73,19 +78,24 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.9.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tinylib/msgp v1.1.8 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.52.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect + go.etcd.io/etcd/api/v3 v3.5.16 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.16 // indirect + go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.21.0 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 0768f7e..18a8ca7 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,8 @@ github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJ github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -18,6 +20,9 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -34,8 +39,6 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -50,8 +53,6 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.17.0 h1:SmVVlfAOtlZncTxRuinDPomC2DkXJ4E5T9gDA0AIH74= -github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA= github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= @@ -66,6 +67,8 @@ github.com/gofiber/contrib/websocket v1.3.0/go.mod h1:xguaOzn2ZZ759LavtosEP+rcxI github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM= github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= @@ -73,6 +76,8 @@ github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EO github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= @@ -150,6 +155,8 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -161,8 +168,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= @@ -284,7 +289,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -299,25 +303,52 @@ github.com/valyala/fasthttp v1.52.0 h1:wqBQpxH71XW0e2g+Og4dzQM8pk34aFYlA1Ga8db7g github.com/valyala/fasthttp v1.52.0/go.mod h1:hf5C4QnVMkNXMspnsUlfM3WitlgYflyhHYoKol/szxQ= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0= +go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28= +go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q= +go.etcd.io/etcd/client/pkg/v3 v3.5.16/go.mod h1:V8acl8pcEK0Y2g19YlOV9m9ssUe6MgiDSobSoaBAM0E= +go.etcd.io/etcd/client/v3 v3.5.16 h1:sSmVYOAHeC9doqi0gv7v86oY/BTld0SEFGaxsU9eRhE= +go.etcd.io/etcd/client/v3 v3.5.16/go.mod h1:X+rExSGkyqxvu276cr2OwPLBaeqFu1cIl4vmRjAD/50= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= +go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= @@ -327,6 +358,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -337,6 +369,7 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -344,9 +377,11 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -372,12 +407,20 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= @@ -386,6 +429,7 @@ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6h google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= @@ -397,7 +441,11 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/datatypes v1.2.0 h1:5YT+eokWdIxhJgWHdrb2zYUimyk0+TaFth+7a0ybzco= diff --git a/pkg/internal/auth/jwt.go b/pkg/internal/auth/jwt.go new file mode 100644 index 0000000..8832b06 --- /dev/null +++ b/pkg/internal/auth/jwt.go @@ -0,0 +1 @@ +package auth diff --git a/pkg/internal/directory/command_rpc.go b/pkg/internal/directory/command_rpc.go index 1d2bb28..8dbd3f8 100644 --- a/pkg/internal/directory/command_rpc.go +++ b/pkg/internal/directory/command_rpc.go @@ -12,7 +12,7 @@ import ( ) type CommandRpcServer struct { - proto.UnimplementedCommandControllerServer + proto.UnimplementedCommandProviderServer } func (c CommandRpcServer) AddCommand(ctx context.Context, info *proto.CommandInfo) (*proto.AddCommandResponse, error) { @@ -66,7 +66,7 @@ func (c CommandRpcServer) SendCommand(ctx context.Context, argument *proto.Comma ctx, cancel := context.WithTimeout(ctx, time.Second*10) defer cancel() - out, err := proto.NewCommandControllerClient(conn).SendCommand(ctx, argument) + out, err := proto.NewCommandProviderClient(conn).SendCommand(ctx, argument) if err != nil { return &proto.CommandReturn{ IsDelivered: true, @@ -99,7 +99,7 @@ func (c CommandRpcServer) SendStreamCommand(g grpc.BidiStreamingServer[proto.Com conn, err := handler.GetGrpcConn() ctx, cancel := context.WithTimeout(g.Context(), time.Second*10) - out, err := proto.NewCommandControllerClient(conn).SendCommand(ctx, pck) + out, err := proto.NewCommandProviderClient(conn).SendCommand(ctx, pck) cancel() if err != nil { diff --git a/pkg/internal/directory/service_mapping.go b/pkg/internal/directory/service_mapping.go index 7db5f06..66c79a5 100644 --- a/pkg/internal/directory/service_mapping.go +++ b/pkg/internal/directory/service_mapping.go @@ -69,7 +69,7 @@ func BroadcastEvent(event string, data any) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() - _, _ = proto.NewServiceDirectoryClient(conn).BroadcastEvent(ctx, &proto.EventInfo{ + _, _ = proto.NewDirectoryServiceClient(conn).BroadcastEvent(ctx, &proto.EventInfo{ Event: event, Data: nex.EncodeMap(data), }) diff --git a/pkg/internal/directory/service_rpc.go b/pkg/internal/directory/service_rpc.go index 0e210c6..a140aca 100644 --- a/pkg/internal/directory/service_rpc.go +++ b/pkg/internal/directory/service_rpc.go @@ -12,7 +12,7 @@ import ( ) type ServiceRpcServer struct { - proto.UnimplementedServiceDirectoryServer + proto.UnimplementedDirectoryServiceServer } func instantiationService(in *ServiceInstance) *proto.ServiceInfo { diff --git a/pkg/internal/grpc/server.go b/pkg/internal/grpc/server.go index 77418c8..c6f2fa8 100644 --- a/pkg/internal/grpc/server.go +++ b/pkg/internal/grpc/server.go @@ -15,8 +15,8 @@ import ( ) type Server struct { - proto.UnimplementedDatabaseControllerServer - proto.UnimplementedStreamControllerServer + proto.UnimplementedDatabaseServiceServer + proto.UnimplementedStreamServiceServer health.UnimplementedHealthServer srv *grpc.Server @@ -27,10 +27,10 @@ func NewServer() *Server { srv: grpc.NewServer(), } - proto.RegisterServiceDirectoryServer(server.srv, &directory2.ServiceRpcServer{}) - proto.RegisterCommandControllerServer(server.srv, &directory2.CommandRpcServer{}) - proto.RegisterDatabaseControllerServer(server.srv, server) - proto.RegisterStreamControllerServer(server.srv, server) + proto.RegisterDirectoryServiceServer(server.srv, &directory2.ServiceRpcServer{}) + proto.RegisterCommandProviderServer(server.srv, &directory2.CommandRpcServer{}) + proto.RegisterDatabaseServiceServer(server.srv, server) + proto.RegisterStreamServiceServer(server.srv, server) health.RegisterHealthServer(server.srv, server) reflection.Register(server.srv) diff --git a/pkg/internal/http/api/command.go b/pkg/internal/http/api/command.go index e49e31b..7a94eaf 100644 --- a/pkg/internal/http/api/command.go +++ b/pkg/internal/http/api/command.go @@ -52,7 +52,7 @@ func invokeCommand(c *fiber.Ctx) error { ctx, cancel := context.WithTimeout(ctx, time.Second*10) defer cancel() - out, err := proto.NewCommandControllerClient(conn).SendCommand(ctx, &proto.CommandArgument{ + out, err := proto.NewCommandProviderClient(conn).SendCommand(ctx, &proto.CommandArgument{ Command: command, Method: method, Payload: c.Body(), diff --git a/pkg/internal/http/ws/ws.go b/pkg/internal/http/ws/ws.go index 50d9b10..e8147b5 100644 --- a/pkg/internal/http/ws/ws.go +++ b/pkg/internal/http/ws/ws.go @@ -60,7 +60,7 @@ func Listen(c *websocket.Conn) { continue } - sc := proto.NewStreamControllerClient(pc) + sc := proto.NewStreamServiceClient(pc) _, err = sc.EmitStreamEvent(context.Background(), &proto.StreamEventRequest{ Event: packet.Action, UserId: uint64(user.ID), diff --git a/pkg/internal/kv/etcd.go b/pkg/internal/kv/etcd.go new file mode 100644 index 0000000..a1e6632 --- /dev/null +++ b/pkg/internal/kv/etcd.go @@ -0,0 +1,19 @@ +package kv + +import ( + clientv3 "go.etcd.io/etcd/client/v3" + "time" +) + +var Kv *clientv3.Client + +func ConnectEtcd(endpoints []string) error { + conn, err := clientv3.New(clientv3.Config{ + Endpoints: endpoints, + DialTimeout: 10 * time.Second, + }) + if err == nil { + Kv = conn + } + return err +} diff --git a/pkg/main.go b/pkg/main.go index 260c15d..0cd2840 100644 --- a/pkg/main.go +++ b/pkg/main.go @@ -4,6 +4,7 @@ import ( "fmt" "git.solsynth.dev/hypernet/nexus/pkg/internal/database" "git.solsynth.dev/hypernet/nexus/pkg/internal/http" + "git.solsynth.dev/hypernet/nexus/pkg/internal/kv" "github.com/fatih/color" "os" "os/signal" @@ -45,6 +46,12 @@ func main() { log.Panic().Err(err).Msg("An error occurred when loading settings.") } + // Connect to kv (etcd) + if err := kv.ConnectEtcd(viper.GetStringSlice("kv.endpoints")); err != nil { + log.Error().Err(err).Msg("An error occurred when connecting to kv (etcd), please check your configuration in kv section.") + log.Fatal().Msg("Kv is required for service discovery and directory feature, cannot be disabled.") + } + // Connect to database if db, err := database.Connect(viper.GetString("database.dsn")); err != nil { log.Error().Err(err).Msg("An error occurred when connecting to database. Database related features will be disabled.") diff --git a/pkg/nex/command.go b/pkg/nex/command.go index b6df17d..c37e0d7 100644 --- a/pkg/nex/command.go +++ b/pkg/nex/command.go @@ -22,7 +22,7 @@ func GetCommandKey(id, method string) string { func (v *Conn) AddCommand(id, method string, tags []string, fn CommandHandler) error { method = strings.ToLower(method) - dir := proto.NewCommandControllerClient(v.nexusConn) + dir := proto.NewCommandProviderClient(v.nexusConn) ctx := context.Background() ctx = metadata.AppendToOutgoingContext(ctx, "client_id", v.Info.Id) @@ -53,7 +53,7 @@ func (v *Conn) AddCommand(id, method string, tags []string, fn CommandHandler) e type localCommandRpcServer struct { conn *Conn - proto.UnimplementedCommandControllerServer + proto.UnimplementedCommandProviderServer health.UnimplementedHealthServer } @@ -137,7 +137,7 @@ func (v localCommandRpcServer) Watch(request *health.HealthCheckRequest, server func (v *Conn) RunCommands(addr string) error { v.commandServer = grpc.NewServer() service := &localCommandRpcServer{conn: v} - proto.RegisterCommandControllerServer(v.commandServer, service) + proto.RegisterCommandProviderServer(v.commandServer, service) health.RegisterHealthServer(v.commandServer, service) reflection.Register(v.commandServer) diff --git a/pkg/nex/conn.go b/pkg/nex/conn.go index e172fdf..211e551 100644 --- a/pkg/nex/conn.go +++ b/pkg/nex/conn.go @@ -45,7 +45,7 @@ func NewNexusConn(addr string, info *proto.ServiceInfo) (*Conn, error) { } func (v *Conn) RegisterService() error { - dir := proto.NewServiceDirectoryClient(v.nexusConn) + dir := proto.NewDirectoryServiceClient(v.nexusConn) ctx := context.Background() ctx = metadata.AppendToOutgoingContext(ctx, "client_id", v.Info.Id) _, err := dir.AddService(ctx, v.Info) @@ -91,7 +91,7 @@ func (v *Conn) GetClientGrpcConn(t string) (*grpc.ClientConn, error) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() - out, err := proto.NewServiceDirectoryClient(v.nexusConn).GetService(ctx, &proto.GetServiceRequest{ + out, err := proto.NewDirectoryServiceClient(v.nexusConn).GetService(ctx, &proto.GetServiceRequest{ Type: &t, }) if err != nil { diff --git a/pkg/nex/cruda/allocator.go b/pkg/nex/cruda/allocator.go index 64f30b5..f39854a 100644 --- a/pkg/nex/cruda/allocator.go +++ b/pkg/nex/cruda/allocator.go @@ -13,7 +13,7 @@ func (v *CrudConn) AllocDatabase(name string) (string, error) { conn := v.Conn.GetNexusGrpcConn() ctx := context.Background() ctx = metadata.AppendToOutgoingContext(ctx, "client_id", v.Conn.Info.Id) - out, err := proto.NewDatabaseControllerClient(conn).AllocDatabase(ctx, &proto.AllocDatabaseRequest{ + out, err := proto.NewDatabaseServiceClient(conn).AllocDatabase(ctx, &proto.AllocDatabaseRequest{ Name: name, }) if err != nil || !out.GetIsSuccess() { diff --git a/pkg/proto/auth.pb.go b/pkg/proto/auth.pb.go index 5a29e0d..7772727 100644 --- a/pkg/proto/auth.pb.go +++ b/pkg/proto/auth.pb.go @@ -657,28 +657,28 @@ var file_auth_proto_rawDesc = []byte{ 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, - 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xb5, 0x02, 0x0a, 0x04, - 0x41, 0x75, 0x74, 0x68, 0x12, 0x36, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x11, - 0x45, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x65, - 0x64, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, - 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x15, 0x45, 0x6e, 0x73, 0x75, 0x72, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x12, - 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, - 0x72, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, - 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x10, + 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xbc, 0x02, 0x0a, 0x0b, + 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x0c, 0x41, + 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x11, 0x45, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x50, 0x65, 0x72, + 0x6d, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, + 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, + 0x15, 0x45, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -710,14 +710,14 @@ var file_auth_proto_depIdxs = []int32{ 0, // 0: proto.AuthInfo.info:type_name -> proto.UserInfo 1, // 1: proto.AuthReply.info:type_name -> proto.AuthInfo 0, // 2: proto.ListUserRelativeResponse.data:type_name -> proto.UserInfo - 2, // 3: proto.Auth.Authenticate:input_type -> proto.AuthRequest - 4, // 4: proto.Auth.EnsurePermGranted:input_type -> proto.CheckPermRequest - 6, // 5: proto.Auth.EnsureUserPermGranted:input_type -> proto.CheckUserPermRequest - 8, // 6: proto.Auth.ListUserRelative:input_type -> proto.ListUserRelativeRequest - 3, // 7: proto.Auth.Authenticate:output_type -> proto.AuthReply - 5, // 8: proto.Auth.EnsurePermGranted:output_type -> proto.CheckPermResponse - 7, // 9: proto.Auth.EnsureUserPermGranted:output_type -> proto.CheckUserPermResponse - 9, // 10: proto.Auth.ListUserRelative:output_type -> proto.ListUserRelativeResponse + 2, // 3: proto.AuthService.Authenticate:input_type -> proto.AuthRequest + 4, // 4: proto.AuthService.EnsurePermGranted:input_type -> proto.CheckPermRequest + 6, // 5: proto.AuthService.EnsureUserPermGranted:input_type -> proto.CheckUserPermRequest + 8, // 6: proto.AuthService.ListUserRelative:input_type -> proto.ListUserRelativeRequest + 3, // 7: proto.AuthService.Authenticate:output_type -> proto.AuthReply + 5, // 8: proto.AuthService.EnsurePermGranted:output_type -> proto.CheckPermResponse + 7, // 9: proto.AuthService.EnsureUserPermGranted:output_type -> proto.CheckUserPermResponse + 9, // 10: proto.AuthService.ListUserRelative:output_type -> proto.ListUserRelativeResponse 7, // [7:11] is the sub-list for method output_type 3, // [3:7] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name diff --git a/pkg/proto/auth.proto b/pkg/proto/auth.proto index 6b57cb8..41e5abf 100644 --- a/pkg/proto/auth.proto +++ b/pkg/proto/auth.proto @@ -4,7 +4,7 @@ option go_package = ".;proto"; package proto; -service Auth { +service AuthService { rpc Authenticate(AuthRequest) returns (AuthReply) {} rpc EnsurePermGranted(CheckPermRequest) returns (CheckPermResponse) {} rpc EnsureUserPermGranted(CheckUserPermRequest) returns (CheckUserPermResponse) {} diff --git a/pkg/proto/auth_grpc.pb.go b/pkg/proto/auth_grpc.pb.go index 3b5ea3f..c5f5153 100644 --- a/pkg/proto/auth_grpc.pb.go +++ b/pkg/proto/auth_grpc.pb.go @@ -19,215 +19,215 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Auth_Authenticate_FullMethodName = "/proto.Auth/Authenticate" - Auth_EnsurePermGranted_FullMethodName = "/proto.Auth/EnsurePermGranted" - Auth_EnsureUserPermGranted_FullMethodName = "/proto.Auth/EnsureUserPermGranted" - Auth_ListUserRelative_FullMethodName = "/proto.Auth/ListUserRelative" + AuthService_Authenticate_FullMethodName = "/proto.AuthService/Authenticate" + AuthService_EnsurePermGranted_FullMethodName = "/proto.AuthService/EnsurePermGranted" + AuthService_EnsureUserPermGranted_FullMethodName = "/proto.AuthService/EnsureUserPermGranted" + AuthService_ListUserRelative_FullMethodName = "/proto.AuthService/ListUserRelative" ) -// AuthClient is the client API for Auth service. +// AuthServiceClient is the client API for AuthService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type AuthClient interface { +type AuthServiceClient interface { Authenticate(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) EnsurePermGranted(ctx context.Context, in *CheckPermRequest, opts ...grpc.CallOption) (*CheckPermResponse, error) EnsureUserPermGranted(ctx context.Context, in *CheckUserPermRequest, opts ...grpc.CallOption) (*CheckUserPermResponse, error) ListUserRelative(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error) } -type authClient struct { +type authServiceClient struct { cc grpc.ClientConnInterface } -func NewAuthClient(cc grpc.ClientConnInterface) AuthClient { - return &authClient{cc} +func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { + return &authServiceClient{cc} } -func (c *authClient) Authenticate(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) { +func (c *authServiceClient) Authenticate(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AuthReply) - err := c.cc.Invoke(ctx, Auth_Authenticate_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, AuthService_Authenticate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *authClient) EnsurePermGranted(ctx context.Context, in *CheckPermRequest, opts ...grpc.CallOption) (*CheckPermResponse, error) { +func (c *authServiceClient) EnsurePermGranted(ctx context.Context, in *CheckPermRequest, opts ...grpc.CallOption) (*CheckPermResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CheckPermResponse) - err := c.cc.Invoke(ctx, Auth_EnsurePermGranted_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, AuthService_EnsurePermGranted_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *authClient) EnsureUserPermGranted(ctx context.Context, in *CheckUserPermRequest, opts ...grpc.CallOption) (*CheckUserPermResponse, error) { +func (c *authServiceClient) EnsureUserPermGranted(ctx context.Context, in *CheckUserPermRequest, opts ...grpc.CallOption) (*CheckUserPermResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CheckUserPermResponse) - err := c.cc.Invoke(ctx, Auth_EnsureUserPermGranted_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, AuthService_EnsureUserPermGranted_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *authClient) ListUserRelative(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error) { +func (c *authServiceClient) ListUserRelative(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListUserRelativeResponse) - err := c.cc.Invoke(ctx, Auth_ListUserRelative_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, AuthService_ListUserRelative_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -// AuthServer is the server API for Auth service. -// All implementations must embed UnimplementedAuthServer +// AuthServiceServer is the server API for AuthService service. +// All implementations must embed UnimplementedAuthServiceServer // for forward compatibility. -type AuthServer interface { +type AuthServiceServer interface { Authenticate(context.Context, *AuthRequest) (*AuthReply, error) EnsurePermGranted(context.Context, *CheckPermRequest) (*CheckPermResponse, error) EnsureUserPermGranted(context.Context, *CheckUserPermRequest) (*CheckUserPermResponse, error) ListUserRelative(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error) - mustEmbedUnimplementedAuthServer() + mustEmbedUnimplementedAuthServiceServer() } -// UnimplementedAuthServer must be embedded to have +// UnimplementedAuthServiceServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. -type UnimplementedAuthServer struct{} +type UnimplementedAuthServiceServer struct{} -func (UnimplementedAuthServer) Authenticate(context.Context, *AuthRequest) (*AuthReply, error) { +func (UnimplementedAuthServiceServer) Authenticate(context.Context, *AuthRequest) (*AuthReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented") } -func (UnimplementedAuthServer) EnsurePermGranted(context.Context, *CheckPermRequest) (*CheckPermResponse, error) { +func (UnimplementedAuthServiceServer) EnsurePermGranted(context.Context, *CheckPermRequest) (*CheckPermResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EnsurePermGranted not implemented") } -func (UnimplementedAuthServer) EnsureUserPermGranted(context.Context, *CheckUserPermRequest) (*CheckUserPermResponse, error) { +func (UnimplementedAuthServiceServer) EnsureUserPermGranted(context.Context, *CheckUserPermRequest) (*CheckUserPermResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EnsureUserPermGranted not implemented") } -func (UnimplementedAuthServer) ListUserRelative(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error) { +func (UnimplementedAuthServiceServer) ListUserRelative(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListUserRelative not implemented") } -func (UnimplementedAuthServer) mustEmbedUnimplementedAuthServer() {} -func (UnimplementedAuthServer) testEmbeddedByValue() {} +func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} +func (UnimplementedAuthServiceServer) testEmbeddedByValue() {} -// UnsafeAuthServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to AuthServer will +// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthServiceServer will // result in compilation errors. -type UnsafeAuthServer interface { - mustEmbedUnimplementedAuthServer() +type UnsafeAuthServiceServer interface { + mustEmbedUnimplementedAuthServiceServer() } -func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer) { - // If the following call pancis, it indicates UnimplementedAuthServer was +func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { + // If the following call pancis, it indicates UnimplementedAuthServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } - s.RegisterService(&Auth_ServiceDesc, srv) + s.RegisterService(&AuthService_ServiceDesc, srv) } -func _Auth_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _AuthService_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AuthRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AuthServer).Authenticate(ctx, in) + return srv.(AuthServiceServer).Authenticate(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Auth_Authenticate_FullMethodName, + FullMethod: AuthService_Authenticate_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).Authenticate(ctx, req.(*AuthRequest)) + return srv.(AuthServiceServer).Authenticate(ctx, req.(*AuthRequest)) } return interceptor(ctx, in, info, handler) } -func _Auth_EnsurePermGranted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _AuthService_EnsurePermGranted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CheckPermRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AuthServer).EnsurePermGranted(ctx, in) + return srv.(AuthServiceServer).EnsurePermGranted(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Auth_EnsurePermGranted_FullMethodName, + FullMethod: AuthService_EnsurePermGranted_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).EnsurePermGranted(ctx, req.(*CheckPermRequest)) + return srv.(AuthServiceServer).EnsurePermGranted(ctx, req.(*CheckPermRequest)) } return interceptor(ctx, in, info, handler) } -func _Auth_EnsureUserPermGranted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _AuthService_EnsureUserPermGranted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CheckUserPermRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AuthServer).EnsureUserPermGranted(ctx, in) + return srv.(AuthServiceServer).EnsureUserPermGranted(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Auth_EnsureUserPermGranted_FullMethodName, + FullMethod: AuthService_EnsureUserPermGranted_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).EnsureUserPermGranted(ctx, req.(*CheckUserPermRequest)) + return srv.(AuthServiceServer).EnsureUserPermGranted(ctx, req.(*CheckUserPermRequest)) } return interceptor(ctx, in, info, handler) } -func _Auth_ListUserRelative_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _AuthService_ListUserRelative_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListUserRelativeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AuthServer).ListUserRelative(ctx, in) + return srv.(AuthServiceServer).ListUserRelative(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Auth_ListUserRelative_FullMethodName, + FullMethod: AuthService_ListUserRelative_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServer).ListUserRelative(ctx, req.(*ListUserRelativeRequest)) + return srv.(AuthServiceServer).ListUserRelative(ctx, req.(*ListUserRelativeRequest)) } return interceptor(ctx, in, info, handler) } -// Auth_ServiceDesc is the grpc.ServiceDesc for Auth service. +// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var Auth_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "proto.Auth", - HandlerType: (*AuthServer)(nil), +var AuthService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.AuthService", + HandlerType: (*AuthServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Authenticate", - Handler: _Auth_Authenticate_Handler, + Handler: _AuthService_Authenticate_Handler, }, { MethodName: "EnsurePermGranted", - Handler: _Auth_EnsurePermGranted_Handler, + Handler: _AuthService_EnsurePermGranted_Handler, }, { MethodName: "EnsureUserPermGranted", - Handler: _Auth_EnsureUserPermGranted_Handler, + Handler: _AuthService_EnsureUserPermGranted_Handler, }, { MethodName: "ListUserRelative", - Handler: _Auth_ListUserRelative_Handler, + Handler: _AuthService_ListUserRelative_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/pkg/proto/command.pb.go b/pkg/proto/command.pb.go index 82c2d89..58e6864 100644 --- a/pkg/proto/command.pb.go +++ b/pkg/proto/command.pb.go @@ -390,27 +390,27 @@ var file_command_proto_rawDesc = []byte{ 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, - 0x08, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32, 0xa8, 0x02, 0x0a, 0x11, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, - 0x3d, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x49, 0x6e, 0x66, - 0x6f, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, - 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, - 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4c, - 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0b, - 0x53, 0x65, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, 0x72, 0x67, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x11, 0x53, - 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x00, - 0x28, 0x01, 0x30, 0x01, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x08, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32, 0xa6, 0x02, 0x0a, 0x0f, 0x43, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3d, 0x0a, + 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x1a, + 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x0d, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1b, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4c, 0x6f, 0x6f, + 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0b, 0x53, 0x65, + 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x11, 0x53, 0x65, 0x6e, + 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x16, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, 0x72, + 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x00, 0x28, 0x01, + 0x30, 0x01, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -435,14 +435,14 @@ var file_command_proto_goTypes = []any{ (*CommandReturn)(nil), // 5: proto.CommandReturn } var file_command_proto_depIdxs = []int32{ - 0, // 0: proto.CommandController.AddCommand:input_type -> proto.CommandInfo - 1, // 1: proto.CommandController.RemoveCommand:input_type -> proto.CommandLookupRequest - 4, // 2: proto.CommandController.SendCommand:input_type -> proto.CommandArgument - 4, // 3: proto.CommandController.SendStreamCommand:input_type -> proto.CommandArgument - 2, // 4: proto.CommandController.AddCommand:output_type -> proto.AddCommandResponse - 3, // 5: proto.CommandController.RemoveCommand:output_type -> proto.RemoveCommandResponse - 5, // 6: proto.CommandController.SendCommand:output_type -> proto.CommandReturn - 5, // 7: proto.CommandController.SendStreamCommand:output_type -> proto.CommandReturn + 0, // 0: proto.CommandProvider.AddCommand:input_type -> proto.CommandInfo + 1, // 1: proto.CommandProvider.RemoveCommand:input_type -> proto.CommandLookupRequest + 4, // 2: proto.CommandProvider.SendCommand:input_type -> proto.CommandArgument + 4, // 3: proto.CommandProvider.SendStreamCommand:input_type -> proto.CommandArgument + 2, // 4: proto.CommandProvider.AddCommand:output_type -> proto.AddCommandResponse + 3, // 5: proto.CommandProvider.RemoveCommand:output_type -> proto.RemoveCommandResponse + 5, // 6: proto.CommandProvider.SendCommand:output_type -> proto.CommandReturn + 5, // 7: proto.CommandProvider.SendStreamCommand:output_type -> proto.CommandReturn 4, // [4:8] is the sub-list for method output_type 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/pkg/proto/command.proto b/pkg/proto/command.proto index 24212f0..9a0e232 100644 --- a/pkg/proto/command.proto +++ b/pkg/proto/command.proto @@ -4,7 +4,7 @@ option go_package = ".;proto"; package proto; -service CommandController { +service CommandProvider { rpc AddCommand(CommandInfo) returns (AddCommandResponse) {} rpc RemoveCommand(CommandLookupRequest) returns (RemoveCommandResponse) {} rpc SendCommand(CommandArgument) returns (CommandReturn) {} diff --git a/pkg/proto/command_grpc.pb.go b/pkg/proto/command_grpc.pb.go index 62fb921..8ae101c 100644 --- a/pkg/proto/command_grpc.pb.go +++ b/pkg/proto/command_grpc.pb.go @@ -19,63 +19,63 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - CommandController_AddCommand_FullMethodName = "/proto.CommandController/AddCommand" - CommandController_RemoveCommand_FullMethodName = "/proto.CommandController/RemoveCommand" - CommandController_SendCommand_FullMethodName = "/proto.CommandController/SendCommand" - CommandController_SendStreamCommand_FullMethodName = "/proto.CommandController/SendStreamCommand" + CommandProvider_AddCommand_FullMethodName = "/proto.CommandProvider/AddCommand" + CommandProvider_RemoveCommand_FullMethodName = "/proto.CommandProvider/RemoveCommand" + CommandProvider_SendCommand_FullMethodName = "/proto.CommandProvider/SendCommand" + CommandProvider_SendStreamCommand_FullMethodName = "/proto.CommandProvider/SendStreamCommand" ) -// CommandControllerClient is the client API for CommandController service. +// CommandProviderClient is the client API for CommandProvider service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type CommandControllerClient interface { +type CommandProviderClient interface { AddCommand(ctx context.Context, in *CommandInfo, opts ...grpc.CallOption) (*AddCommandResponse, error) RemoveCommand(ctx context.Context, in *CommandLookupRequest, opts ...grpc.CallOption) (*RemoveCommandResponse, error) SendCommand(ctx context.Context, in *CommandArgument, opts ...grpc.CallOption) (*CommandReturn, error) SendStreamCommand(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CommandArgument, CommandReturn], error) } -type commandControllerClient struct { +type commandProviderClient struct { cc grpc.ClientConnInterface } -func NewCommandControllerClient(cc grpc.ClientConnInterface) CommandControllerClient { - return &commandControllerClient{cc} +func NewCommandProviderClient(cc grpc.ClientConnInterface) CommandProviderClient { + return &commandProviderClient{cc} } -func (c *commandControllerClient) AddCommand(ctx context.Context, in *CommandInfo, opts ...grpc.CallOption) (*AddCommandResponse, error) { +func (c *commandProviderClient) AddCommand(ctx context.Context, in *CommandInfo, opts ...grpc.CallOption) (*AddCommandResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AddCommandResponse) - err := c.cc.Invoke(ctx, CommandController_AddCommand_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, CommandProvider_AddCommand_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *commandControllerClient) RemoveCommand(ctx context.Context, in *CommandLookupRequest, opts ...grpc.CallOption) (*RemoveCommandResponse, error) { +func (c *commandProviderClient) RemoveCommand(ctx context.Context, in *CommandLookupRequest, opts ...grpc.CallOption) (*RemoveCommandResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RemoveCommandResponse) - err := c.cc.Invoke(ctx, CommandController_RemoveCommand_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, CommandProvider_RemoveCommand_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *commandControllerClient) SendCommand(ctx context.Context, in *CommandArgument, opts ...grpc.CallOption) (*CommandReturn, error) { +func (c *commandProviderClient) SendCommand(ctx context.Context, in *CommandArgument, opts ...grpc.CallOption) (*CommandReturn, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CommandReturn) - err := c.cc.Invoke(ctx, CommandController_SendCommand_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, CommandProvider_SendCommand_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *commandControllerClient) SendStreamCommand(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CommandArgument, CommandReturn], error) { +func (c *commandProviderClient) SendStreamCommand(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CommandArgument, CommandReturn], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &CommandController_ServiceDesc.Streams[0], CommandController_SendStreamCommand_FullMethodName, cOpts...) + stream, err := c.cc.NewStream(ctx, &CommandProvider_ServiceDesc.Streams[0], CommandProvider_SendStreamCommand_FullMethodName, cOpts...) if err != nil { return nil, err } @@ -84,144 +84,144 @@ func (c *commandControllerClient) SendStreamCommand(ctx context.Context, opts .. } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type CommandController_SendStreamCommandClient = grpc.BidiStreamingClient[CommandArgument, CommandReturn] +type CommandProvider_SendStreamCommandClient = grpc.BidiStreamingClient[CommandArgument, CommandReturn] -// CommandControllerServer is the server API for CommandController service. -// All implementations must embed UnimplementedCommandControllerServer +// CommandProviderServer is the server API for CommandProvider service. +// All implementations must embed UnimplementedCommandProviderServer // for forward compatibility. -type CommandControllerServer interface { +type CommandProviderServer interface { AddCommand(context.Context, *CommandInfo) (*AddCommandResponse, error) RemoveCommand(context.Context, *CommandLookupRequest) (*RemoveCommandResponse, error) SendCommand(context.Context, *CommandArgument) (*CommandReturn, error) SendStreamCommand(grpc.BidiStreamingServer[CommandArgument, CommandReturn]) error - mustEmbedUnimplementedCommandControllerServer() + mustEmbedUnimplementedCommandProviderServer() } -// UnimplementedCommandControllerServer must be embedded to have +// UnimplementedCommandProviderServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. -type UnimplementedCommandControllerServer struct{} +type UnimplementedCommandProviderServer struct{} -func (UnimplementedCommandControllerServer) AddCommand(context.Context, *CommandInfo) (*AddCommandResponse, error) { +func (UnimplementedCommandProviderServer) AddCommand(context.Context, *CommandInfo) (*AddCommandResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddCommand not implemented") } -func (UnimplementedCommandControllerServer) RemoveCommand(context.Context, *CommandLookupRequest) (*RemoveCommandResponse, error) { +func (UnimplementedCommandProviderServer) RemoveCommand(context.Context, *CommandLookupRequest) (*RemoveCommandResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveCommand not implemented") } -func (UnimplementedCommandControllerServer) SendCommand(context.Context, *CommandArgument) (*CommandReturn, error) { +func (UnimplementedCommandProviderServer) SendCommand(context.Context, *CommandArgument) (*CommandReturn, error) { return nil, status.Errorf(codes.Unimplemented, "method SendCommand not implemented") } -func (UnimplementedCommandControllerServer) SendStreamCommand(grpc.BidiStreamingServer[CommandArgument, CommandReturn]) error { +func (UnimplementedCommandProviderServer) SendStreamCommand(grpc.BidiStreamingServer[CommandArgument, CommandReturn]) error { return status.Errorf(codes.Unimplemented, "method SendStreamCommand not implemented") } -func (UnimplementedCommandControllerServer) mustEmbedUnimplementedCommandControllerServer() {} -func (UnimplementedCommandControllerServer) testEmbeddedByValue() {} +func (UnimplementedCommandProviderServer) mustEmbedUnimplementedCommandProviderServer() {} +func (UnimplementedCommandProviderServer) testEmbeddedByValue() {} -// UnsafeCommandControllerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CommandControllerServer will +// UnsafeCommandProviderServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CommandProviderServer will // result in compilation errors. -type UnsafeCommandControllerServer interface { - mustEmbedUnimplementedCommandControllerServer() +type UnsafeCommandProviderServer interface { + mustEmbedUnimplementedCommandProviderServer() } -func RegisterCommandControllerServer(s grpc.ServiceRegistrar, srv CommandControllerServer) { - // If the following call pancis, it indicates UnimplementedCommandControllerServer was +func RegisterCommandProviderServer(s grpc.ServiceRegistrar, srv CommandProviderServer) { + // If the following call pancis, it indicates UnimplementedCommandProviderServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } - s.RegisterService(&CommandController_ServiceDesc, srv) + s.RegisterService(&CommandProvider_ServiceDesc, srv) } -func _CommandController_AddCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CommandProvider_AddCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CommandInfo) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommandControllerServer).AddCommand(ctx, in) + return srv.(CommandProviderServer).AddCommand(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: CommandController_AddCommand_FullMethodName, + FullMethod: CommandProvider_AddCommand_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommandControllerServer).AddCommand(ctx, req.(*CommandInfo)) + return srv.(CommandProviderServer).AddCommand(ctx, req.(*CommandInfo)) } return interceptor(ctx, in, info, handler) } -func _CommandController_RemoveCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CommandProvider_RemoveCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CommandLookupRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommandControllerServer).RemoveCommand(ctx, in) + return srv.(CommandProviderServer).RemoveCommand(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: CommandController_RemoveCommand_FullMethodName, + FullMethod: CommandProvider_RemoveCommand_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommandControllerServer).RemoveCommand(ctx, req.(*CommandLookupRequest)) + return srv.(CommandProviderServer).RemoveCommand(ctx, req.(*CommandLookupRequest)) } return interceptor(ctx, in, info, handler) } -func _CommandController_SendCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _CommandProvider_SendCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CommandArgument) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommandControllerServer).SendCommand(ctx, in) + return srv.(CommandProviderServer).SendCommand(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: CommandController_SendCommand_FullMethodName, + FullMethod: CommandProvider_SendCommand_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommandControllerServer).SendCommand(ctx, req.(*CommandArgument)) + return srv.(CommandProviderServer).SendCommand(ctx, req.(*CommandArgument)) } return interceptor(ctx, in, info, handler) } -func _CommandController_SendStreamCommand_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CommandControllerServer).SendStreamCommand(&grpc.GenericServerStream[CommandArgument, CommandReturn]{ServerStream: stream}) +func _CommandProvider_SendStreamCommand_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(CommandProviderServer).SendStreamCommand(&grpc.GenericServerStream[CommandArgument, CommandReturn]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type CommandController_SendStreamCommandServer = grpc.BidiStreamingServer[CommandArgument, CommandReturn] +type CommandProvider_SendStreamCommandServer = grpc.BidiStreamingServer[CommandArgument, CommandReturn] -// CommandController_ServiceDesc is the grpc.ServiceDesc for CommandController service. +// CommandProvider_ServiceDesc is the grpc.ServiceDesc for CommandProvider service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var CommandController_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "proto.CommandController", - HandlerType: (*CommandControllerServer)(nil), +var CommandProvider_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.CommandProvider", + HandlerType: (*CommandProviderServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddCommand", - Handler: _CommandController_AddCommand_Handler, + Handler: _CommandProvider_AddCommand_Handler, }, { MethodName: "RemoveCommand", - Handler: _CommandController_RemoveCommand_Handler, + Handler: _CommandProvider_RemoveCommand_Handler, }, { MethodName: "SendCommand", - Handler: _CommandController_SendCommand_Handler, + Handler: _CommandProvider_SendCommand_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "SendStreamCommand", - Handler: _CommandController_SendStreamCommand_Handler, + Handler: _CommandProvider_SendStreamCommand_Handler, ServerStreams: true, ClientStreams: true, }, diff --git a/pkg/proto/database.pb.go b/pkg/proto/database.pb.go index 4535c1f..71f6c63 100644 --- a/pkg/proto/database.pb.go +++ b/pkg/proto/database.pb.go @@ -129,15 +129,15 @@ var file_database_proto_rawDesc = []byte{ 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x64, - 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, 0x6e, 0x32, 0x62, 0x0a, - 0x12, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x0d, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x44, 0x61, 0x74, 0x61, - 0x62, 0x61, 0x73, 0x65, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x6c, - 0x6f, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x44, - 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, 0x6e, 0x32, 0x5f, 0x0a, + 0x0f, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x4c, 0x0a, 0x0d, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, + 0x65, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x44, + 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x44, 0x61, 0x74, 0x61, + 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, + 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -158,8 +158,8 @@ var file_database_proto_goTypes = []any{ (*AllocDatabaseResponse)(nil), // 1: proto.AllocDatabaseResponse } var file_database_proto_depIdxs = []int32{ - 0, // 0: proto.DatabaseController.AllocDatabase:input_type -> proto.AllocDatabaseRequest - 1, // 1: proto.DatabaseController.AllocDatabase:output_type -> proto.AllocDatabaseResponse + 0, // 0: proto.DatabaseService.AllocDatabase:input_type -> proto.AllocDatabaseRequest + 1, // 1: proto.DatabaseService.AllocDatabase:output_type -> proto.AllocDatabaseResponse 1, // [1:2] is the sub-list for method output_type 0, // [0:1] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/pkg/proto/database.proto b/pkg/proto/database.proto index f7b4622..41d9934 100644 --- a/pkg/proto/database.proto +++ b/pkg/proto/database.proto @@ -4,7 +4,7 @@ option go_package = ".;proto"; package proto; -service DatabaseController { +service DatabaseService { rpc AllocDatabase(AllocDatabaseRequest) returns (AllocDatabaseResponse) {} } diff --git a/pkg/proto/database_grpc.pb.go b/pkg/proto/database_grpc.pb.go index c7b8c3b..b383471 100644 --- a/pkg/proto/database_grpc.pb.go +++ b/pkg/proto/database_grpc.pb.go @@ -19,101 +19,101 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - DatabaseController_AllocDatabase_FullMethodName = "/proto.DatabaseController/AllocDatabase" + DatabaseService_AllocDatabase_FullMethodName = "/proto.DatabaseService/AllocDatabase" ) -// DatabaseControllerClient is the client API for DatabaseController service. +// DatabaseServiceClient is the client API for DatabaseService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type DatabaseControllerClient interface { +type DatabaseServiceClient interface { AllocDatabase(ctx context.Context, in *AllocDatabaseRequest, opts ...grpc.CallOption) (*AllocDatabaseResponse, error) } -type databaseControllerClient struct { +type databaseServiceClient struct { cc grpc.ClientConnInterface } -func NewDatabaseControllerClient(cc grpc.ClientConnInterface) DatabaseControllerClient { - return &databaseControllerClient{cc} +func NewDatabaseServiceClient(cc grpc.ClientConnInterface) DatabaseServiceClient { + return &databaseServiceClient{cc} } -func (c *databaseControllerClient) AllocDatabase(ctx context.Context, in *AllocDatabaseRequest, opts ...grpc.CallOption) (*AllocDatabaseResponse, error) { +func (c *databaseServiceClient) AllocDatabase(ctx context.Context, in *AllocDatabaseRequest, opts ...grpc.CallOption) (*AllocDatabaseResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AllocDatabaseResponse) - err := c.cc.Invoke(ctx, DatabaseController_AllocDatabase_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, DatabaseService_AllocDatabase_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -// DatabaseControllerServer is the server API for DatabaseController service. -// All implementations must embed UnimplementedDatabaseControllerServer +// DatabaseServiceServer is the server API for DatabaseService service. +// All implementations must embed UnimplementedDatabaseServiceServer // for forward compatibility. -type DatabaseControllerServer interface { +type DatabaseServiceServer interface { AllocDatabase(context.Context, *AllocDatabaseRequest) (*AllocDatabaseResponse, error) - mustEmbedUnimplementedDatabaseControllerServer() + mustEmbedUnimplementedDatabaseServiceServer() } -// UnimplementedDatabaseControllerServer must be embedded to have +// UnimplementedDatabaseServiceServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. -type UnimplementedDatabaseControllerServer struct{} +type UnimplementedDatabaseServiceServer struct{} -func (UnimplementedDatabaseControllerServer) AllocDatabase(context.Context, *AllocDatabaseRequest) (*AllocDatabaseResponse, error) { +func (UnimplementedDatabaseServiceServer) AllocDatabase(context.Context, *AllocDatabaseRequest) (*AllocDatabaseResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllocDatabase not implemented") } -func (UnimplementedDatabaseControllerServer) mustEmbedUnimplementedDatabaseControllerServer() {} -func (UnimplementedDatabaseControllerServer) testEmbeddedByValue() {} +func (UnimplementedDatabaseServiceServer) mustEmbedUnimplementedDatabaseServiceServer() {} +func (UnimplementedDatabaseServiceServer) testEmbeddedByValue() {} -// UnsafeDatabaseControllerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to DatabaseControllerServer will +// UnsafeDatabaseServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DatabaseServiceServer will // result in compilation errors. -type UnsafeDatabaseControllerServer interface { - mustEmbedUnimplementedDatabaseControllerServer() +type UnsafeDatabaseServiceServer interface { + mustEmbedUnimplementedDatabaseServiceServer() } -func RegisterDatabaseControllerServer(s grpc.ServiceRegistrar, srv DatabaseControllerServer) { - // If the following call pancis, it indicates UnimplementedDatabaseControllerServer was +func RegisterDatabaseServiceServer(s grpc.ServiceRegistrar, srv DatabaseServiceServer) { + // If the following call pancis, it indicates UnimplementedDatabaseServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } - s.RegisterService(&DatabaseController_ServiceDesc, srv) + s.RegisterService(&DatabaseService_ServiceDesc, srv) } -func _DatabaseController_AllocDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _DatabaseService_AllocDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AllocDatabaseRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(DatabaseControllerServer).AllocDatabase(ctx, in) + return srv.(DatabaseServiceServer).AllocDatabase(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: DatabaseController_AllocDatabase_FullMethodName, + FullMethod: DatabaseService_AllocDatabase_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DatabaseControllerServer).AllocDatabase(ctx, req.(*AllocDatabaseRequest)) + return srv.(DatabaseServiceServer).AllocDatabase(ctx, req.(*AllocDatabaseRequest)) } return interceptor(ctx, in, info, handler) } -// DatabaseController_ServiceDesc is the grpc.ServiceDesc for DatabaseController service. +// DatabaseService_ServiceDesc is the grpc.ServiceDesc for DatabaseService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var DatabaseController_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "proto.DatabaseController", - HandlerType: (*DatabaseControllerServer)(nil), +var DatabaseService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.DatabaseService", + HandlerType: (*DatabaseServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AllocDatabase", - Handler: _DatabaseController_AllocDatabase_Handler, + Handler: _DatabaseService_AllocDatabase_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/pkg/proto/services.pb.go b/pkg/proto/services.pb.go index 2068764..7a11b0d 100644 --- a/pkg/proto/services.pb.go +++ b/pkg/proto/services.pb.go @@ -553,8 +553,8 @@ var file_services_proto_rawDesc = []byte{ 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x0f, 0x0a, 0x0d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x32, 0xe8, 0x02, 0x0a, 0x10, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x43, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, + 0x6e, 0x73, 0x65, 0x32, 0xe8, 0x02, 0x0a, 0x10, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, @@ -608,16 +608,16 @@ var file_services_proto_goTypes = []any{ var file_services_proto_depIdxs = []int32{ 0, // 0: proto.GetServiceResponse.data:type_name -> proto.ServiceInfo 0, // 1: proto.ListServiceResponse.data:type_name -> proto.ServiceInfo - 1, // 2: proto.ServiceDirectory.GetService:input_type -> proto.GetServiceRequest - 3, // 3: proto.ServiceDirectory.ListService:input_type -> proto.ListServiceRequest - 0, // 4: proto.ServiceDirectory.AddService:input_type -> proto.ServiceInfo - 6, // 5: proto.ServiceDirectory.RemoveService:input_type -> proto.RemoveServiceRequest - 8, // 6: proto.ServiceDirectory.BroadcastEvent:input_type -> proto.EventInfo - 2, // 7: proto.ServiceDirectory.GetService:output_type -> proto.GetServiceResponse - 4, // 8: proto.ServiceDirectory.ListService:output_type -> proto.ListServiceResponse - 5, // 9: proto.ServiceDirectory.AddService:output_type -> proto.AddServiceResponse - 7, // 10: proto.ServiceDirectory.RemoveService:output_type -> proto.RemoveServiceResponse - 9, // 11: proto.ServiceDirectory.BroadcastEvent:output_type -> proto.EventResponse + 1, // 2: proto.DirectoryService.GetService:input_type -> proto.GetServiceRequest + 3, // 3: proto.DirectoryService.ListService:input_type -> proto.ListServiceRequest + 0, // 4: proto.DirectoryService.AddService:input_type -> proto.ServiceInfo + 6, // 5: proto.DirectoryService.RemoveService:input_type -> proto.RemoveServiceRequest + 8, // 6: proto.DirectoryService.BroadcastEvent:input_type -> proto.EventInfo + 2, // 7: proto.DirectoryService.GetService:output_type -> proto.GetServiceResponse + 4, // 8: proto.DirectoryService.ListService:output_type -> proto.ListServiceResponse + 5, // 9: proto.DirectoryService.AddService:output_type -> proto.AddServiceResponse + 7, // 10: proto.DirectoryService.RemoveService:output_type -> proto.RemoveServiceResponse + 9, // 11: proto.DirectoryService.BroadcastEvent:output_type -> proto.EventResponse 7, // [7:12] is the sub-list for method output_type 2, // [2:7] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name diff --git a/pkg/proto/services.proto b/pkg/proto/services.proto index 0500772..3a1efba 100644 --- a/pkg/proto/services.proto +++ b/pkg/proto/services.proto @@ -4,7 +4,7 @@ option go_package = ".;proto"; package proto; -service ServiceDirectory { +service DirectoryService { rpc GetService(GetServiceRequest) returns (GetServiceResponse) {} rpc ListService(ListServiceRequest) returns (ListServiceResponse) {} rpc AddService(ServiceInfo) returns (AddServiceResponse) {} diff --git a/pkg/proto/services_grpc.pb.go b/pkg/proto/services_grpc.pb.go index e151626..bbe6109 100644 --- a/pkg/proto/services_grpc.pb.go +++ b/pkg/proto/services_grpc.pb.go @@ -19,17 +19,17 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - ServiceDirectory_GetService_FullMethodName = "/proto.ServiceDirectory/GetService" - ServiceDirectory_ListService_FullMethodName = "/proto.ServiceDirectory/ListService" - ServiceDirectory_AddService_FullMethodName = "/proto.ServiceDirectory/AddService" - ServiceDirectory_RemoveService_FullMethodName = "/proto.ServiceDirectory/RemoveService" - ServiceDirectory_BroadcastEvent_FullMethodName = "/proto.ServiceDirectory/BroadcastEvent" + DirectoryService_GetService_FullMethodName = "/proto.DirectoryService/GetService" + DirectoryService_ListService_FullMethodName = "/proto.DirectoryService/ListService" + DirectoryService_AddService_FullMethodName = "/proto.DirectoryService/AddService" + DirectoryService_RemoveService_FullMethodName = "/proto.DirectoryService/RemoveService" + DirectoryService_BroadcastEvent_FullMethodName = "/proto.DirectoryService/BroadcastEvent" ) -// ServiceDirectoryClient is the client API for ServiceDirectory service. +// DirectoryServiceClient is the client API for DirectoryService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ServiceDirectoryClient interface { +type DirectoryServiceClient interface { GetService(ctx context.Context, in *GetServiceRequest, opts ...grpc.CallOption) (*GetServiceResponse, error) ListService(ctx context.Context, in *ListServiceRequest, opts ...grpc.CallOption) (*ListServiceResponse, error) AddService(ctx context.Context, in *ServiceInfo, opts ...grpc.CallOption) (*AddServiceResponse, error) @@ -37,235 +37,235 @@ type ServiceDirectoryClient interface { BroadcastEvent(ctx context.Context, in *EventInfo, opts ...grpc.CallOption) (*EventResponse, error) } -type serviceDirectoryClient struct { +type directoryServiceClient struct { cc grpc.ClientConnInterface } -func NewServiceDirectoryClient(cc grpc.ClientConnInterface) ServiceDirectoryClient { - return &serviceDirectoryClient{cc} +func NewDirectoryServiceClient(cc grpc.ClientConnInterface) DirectoryServiceClient { + return &directoryServiceClient{cc} } -func (c *serviceDirectoryClient) GetService(ctx context.Context, in *GetServiceRequest, opts ...grpc.CallOption) (*GetServiceResponse, error) { +func (c *directoryServiceClient) GetService(ctx context.Context, in *GetServiceRequest, opts ...grpc.CallOption) (*GetServiceResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetServiceResponse) - err := c.cc.Invoke(ctx, ServiceDirectory_GetService_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, DirectoryService_GetService_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *serviceDirectoryClient) ListService(ctx context.Context, in *ListServiceRequest, opts ...grpc.CallOption) (*ListServiceResponse, error) { +func (c *directoryServiceClient) ListService(ctx context.Context, in *ListServiceRequest, opts ...grpc.CallOption) (*ListServiceResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListServiceResponse) - err := c.cc.Invoke(ctx, ServiceDirectory_ListService_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, DirectoryService_ListService_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *serviceDirectoryClient) AddService(ctx context.Context, in *ServiceInfo, opts ...grpc.CallOption) (*AddServiceResponse, error) { +func (c *directoryServiceClient) AddService(ctx context.Context, in *ServiceInfo, opts ...grpc.CallOption) (*AddServiceResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AddServiceResponse) - err := c.cc.Invoke(ctx, ServiceDirectory_AddService_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, DirectoryService_AddService_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *serviceDirectoryClient) RemoveService(ctx context.Context, in *RemoveServiceRequest, opts ...grpc.CallOption) (*RemoveServiceResponse, error) { +func (c *directoryServiceClient) RemoveService(ctx context.Context, in *RemoveServiceRequest, opts ...grpc.CallOption) (*RemoveServiceResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RemoveServiceResponse) - err := c.cc.Invoke(ctx, ServiceDirectory_RemoveService_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, DirectoryService_RemoveService_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *serviceDirectoryClient) BroadcastEvent(ctx context.Context, in *EventInfo, opts ...grpc.CallOption) (*EventResponse, error) { +func (c *directoryServiceClient) BroadcastEvent(ctx context.Context, in *EventInfo, opts ...grpc.CallOption) (*EventResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(EventResponse) - err := c.cc.Invoke(ctx, ServiceDirectory_BroadcastEvent_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, DirectoryService_BroadcastEvent_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -// ServiceDirectoryServer is the server API for ServiceDirectory service. -// All implementations must embed UnimplementedServiceDirectoryServer +// DirectoryServiceServer is the server API for DirectoryService service. +// All implementations must embed UnimplementedDirectoryServiceServer // for forward compatibility. -type ServiceDirectoryServer interface { +type DirectoryServiceServer interface { GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error) ListService(context.Context, *ListServiceRequest) (*ListServiceResponse, error) AddService(context.Context, *ServiceInfo) (*AddServiceResponse, error) RemoveService(context.Context, *RemoveServiceRequest) (*RemoveServiceResponse, error) BroadcastEvent(context.Context, *EventInfo) (*EventResponse, error) - mustEmbedUnimplementedServiceDirectoryServer() + mustEmbedUnimplementedDirectoryServiceServer() } -// UnimplementedServiceDirectoryServer must be embedded to have +// UnimplementedDirectoryServiceServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. -type UnimplementedServiceDirectoryServer struct{} +type UnimplementedDirectoryServiceServer struct{} -func (UnimplementedServiceDirectoryServer) GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error) { +func (UnimplementedDirectoryServiceServer) GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetService not implemented") } -func (UnimplementedServiceDirectoryServer) ListService(context.Context, *ListServiceRequest) (*ListServiceResponse, error) { +func (UnimplementedDirectoryServiceServer) ListService(context.Context, *ListServiceRequest) (*ListServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListService not implemented") } -func (UnimplementedServiceDirectoryServer) AddService(context.Context, *ServiceInfo) (*AddServiceResponse, error) { +func (UnimplementedDirectoryServiceServer) AddService(context.Context, *ServiceInfo) (*AddServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddService not implemented") } -func (UnimplementedServiceDirectoryServer) RemoveService(context.Context, *RemoveServiceRequest) (*RemoveServiceResponse, error) { +func (UnimplementedDirectoryServiceServer) RemoveService(context.Context, *RemoveServiceRequest) (*RemoveServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveService not implemented") } -func (UnimplementedServiceDirectoryServer) BroadcastEvent(context.Context, *EventInfo) (*EventResponse, error) { +func (UnimplementedDirectoryServiceServer) BroadcastEvent(context.Context, *EventInfo) (*EventResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BroadcastEvent not implemented") } -func (UnimplementedServiceDirectoryServer) mustEmbedUnimplementedServiceDirectoryServer() {} -func (UnimplementedServiceDirectoryServer) testEmbeddedByValue() {} +func (UnimplementedDirectoryServiceServer) mustEmbedUnimplementedDirectoryServiceServer() {} +func (UnimplementedDirectoryServiceServer) testEmbeddedByValue() {} -// UnsafeServiceDirectoryServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ServiceDirectoryServer will +// UnsafeDirectoryServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DirectoryServiceServer will // result in compilation errors. -type UnsafeServiceDirectoryServer interface { - mustEmbedUnimplementedServiceDirectoryServer() +type UnsafeDirectoryServiceServer interface { + mustEmbedUnimplementedDirectoryServiceServer() } -func RegisterServiceDirectoryServer(s grpc.ServiceRegistrar, srv ServiceDirectoryServer) { - // If the following call pancis, it indicates UnimplementedServiceDirectoryServer was +func RegisterDirectoryServiceServer(s grpc.ServiceRegistrar, srv DirectoryServiceServer) { + // If the following call pancis, it indicates UnimplementedDirectoryServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } - s.RegisterService(&ServiceDirectory_ServiceDesc, srv) + s.RegisterService(&DirectoryService_ServiceDesc, srv) } -func _ServiceDirectory_GetService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _DirectoryService_GetService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetServiceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceDirectoryServer).GetService(ctx, in) + return srv.(DirectoryServiceServer).GetService(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ServiceDirectory_GetService_FullMethodName, + FullMethod: DirectoryService_GetService_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceDirectoryServer).GetService(ctx, req.(*GetServiceRequest)) + return srv.(DirectoryServiceServer).GetService(ctx, req.(*GetServiceRequest)) } return interceptor(ctx, in, info, handler) } -func _ServiceDirectory_ListService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _DirectoryService_ListService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListServiceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceDirectoryServer).ListService(ctx, in) + return srv.(DirectoryServiceServer).ListService(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ServiceDirectory_ListService_FullMethodName, + FullMethod: DirectoryService_ListService_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceDirectoryServer).ListService(ctx, req.(*ListServiceRequest)) + return srv.(DirectoryServiceServer).ListService(ctx, req.(*ListServiceRequest)) } return interceptor(ctx, in, info, handler) } -func _ServiceDirectory_AddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _DirectoryService_AddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ServiceInfo) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceDirectoryServer).AddService(ctx, in) + return srv.(DirectoryServiceServer).AddService(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ServiceDirectory_AddService_FullMethodName, + FullMethod: DirectoryService_AddService_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceDirectoryServer).AddService(ctx, req.(*ServiceInfo)) + return srv.(DirectoryServiceServer).AddService(ctx, req.(*ServiceInfo)) } return interceptor(ctx, in, info, handler) } -func _ServiceDirectory_RemoveService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _DirectoryService_RemoveService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RemoveServiceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceDirectoryServer).RemoveService(ctx, in) + return srv.(DirectoryServiceServer).RemoveService(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ServiceDirectory_RemoveService_FullMethodName, + FullMethod: DirectoryService_RemoveService_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceDirectoryServer).RemoveService(ctx, req.(*RemoveServiceRequest)) + return srv.(DirectoryServiceServer).RemoveService(ctx, req.(*RemoveServiceRequest)) } return interceptor(ctx, in, info, handler) } -func _ServiceDirectory_BroadcastEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _DirectoryService_BroadcastEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(EventInfo) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ServiceDirectoryServer).BroadcastEvent(ctx, in) + return srv.(DirectoryServiceServer).BroadcastEvent(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ServiceDirectory_BroadcastEvent_FullMethodName, + FullMethod: DirectoryService_BroadcastEvent_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceDirectoryServer).BroadcastEvent(ctx, req.(*EventInfo)) + return srv.(DirectoryServiceServer).BroadcastEvent(ctx, req.(*EventInfo)) } return interceptor(ctx, in, info, handler) } -// ServiceDirectory_ServiceDesc is the grpc.ServiceDesc for ServiceDirectory service. +// DirectoryService_ServiceDesc is the grpc.ServiceDesc for DirectoryService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var ServiceDirectory_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "proto.ServiceDirectory", - HandlerType: (*ServiceDirectoryServer)(nil), +var DirectoryService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.DirectoryService", + HandlerType: (*DirectoryServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetService", - Handler: _ServiceDirectory_GetService_Handler, + Handler: _DirectoryService_GetService_Handler, }, { MethodName: "ListService", - Handler: _ServiceDirectory_ListService_Handler, + Handler: _DirectoryService_ListService_Handler, }, { MethodName: "AddService", - Handler: _ServiceDirectory_AddService_Handler, + Handler: _DirectoryService_AddService_Handler, }, { MethodName: "RemoveService", - Handler: _ServiceDirectory_RemoveService_Handler, + Handler: _DirectoryService_RemoveService_Handler, }, { MethodName: "BroadcastEvent", - Handler: _ServiceDirectory_BroadcastEvent_Handler, + Handler: _DirectoryService_BroadcastEvent_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/pkg/proto/stream.pb.go b/pkg/proto/stream.pb.go index 5dc74cc..203bc0d 100644 --- a/pkg/proto/stream.pb.go +++ b/pkg/proto/stream.pb.go @@ -440,25 +440,24 @@ var file_stream_proto_rawDesc = []byte{ 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x80, 0x02, 0x0a, 0x10, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x12, 0x58, 0x0a, 0x15, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0a, 0x50, 0x75, - 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x4d, 0x0a, 0x0f, 0x50, 0x75, 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, - 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xfd, 0x01, 0x0a, 0x0d, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, + 0x15, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0a, 0x50, 0x75, 0x73, 0x68, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, + 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0f, + 0x50, 0x75, 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, + 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, + 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -484,12 +483,12 @@ var file_stream_proto_goTypes = []any{ (*StreamEventResponse)(nil), // 6: proto.StreamEventResponse } var file_stream_proto_depIdxs = []int32{ - 0, // 0: proto.StreamController.CountStreamConnection:input_type -> proto.CountConnectionRequest - 2, // 1: proto.StreamController.PushStream:input_type -> proto.PushStreamRequest - 3, // 2: proto.StreamController.PushStreamBatch:input_type -> proto.PushStreamBatchRequest - 1, // 3: proto.StreamController.CountStreamConnection:output_type -> proto.CountConnectionResponse - 4, // 4: proto.StreamController.PushStream:output_type -> proto.PushStreamResponse - 4, // 5: proto.StreamController.PushStreamBatch:output_type -> proto.PushStreamResponse + 0, // 0: proto.StreamService.CountStreamConnection:input_type -> proto.CountConnectionRequest + 2, // 1: proto.StreamService.PushStream:input_type -> proto.PushStreamRequest + 3, // 2: proto.StreamService.PushStreamBatch:input_type -> proto.PushStreamBatchRequest + 1, // 3: proto.StreamService.CountStreamConnection:output_type -> proto.CountConnectionResponse + 4, // 4: proto.StreamService.PushStream:output_type -> proto.PushStreamResponse + 4, // 5: proto.StreamService.PushStreamBatch:output_type -> proto.PushStreamResponse 3, // [3:6] is the sub-list for method output_type 0, // [0:3] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/pkg/proto/stream.proto b/pkg/proto/stream.proto index 1d03bc1..5648097 100644 --- a/pkg/proto/stream.proto +++ b/pkg/proto/stream.proto @@ -4,7 +4,7 @@ option go_package = ".;proto"; package proto; -service StreamController { +service StreamService { rpc CountStreamConnection(CountConnectionRequest) returns (CountConnectionResponse) {} rpc PushStream(PushStreamRequest) returns (PushStreamResponse) {} rpc PushStreamBatch(PushStreamBatchRequest) returns (PushStreamResponse) {} diff --git a/pkg/proto/stream_grpc.pb.go b/pkg/proto/stream_grpc.pb.go index 9e93ad2..b1f96c3 100644 --- a/pkg/proto/stream_grpc.pb.go +++ b/pkg/proto/stream_grpc.pb.go @@ -19,177 +19,177 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - StreamController_CountStreamConnection_FullMethodName = "/proto.StreamController/CountStreamConnection" - StreamController_PushStream_FullMethodName = "/proto.StreamController/PushStream" - StreamController_PushStreamBatch_FullMethodName = "/proto.StreamController/PushStreamBatch" + StreamService_CountStreamConnection_FullMethodName = "/proto.StreamService/CountStreamConnection" + StreamService_PushStream_FullMethodName = "/proto.StreamService/PushStream" + StreamService_PushStreamBatch_FullMethodName = "/proto.StreamService/PushStreamBatch" ) -// StreamControllerClient is the client API for StreamController service. +// StreamServiceClient is the client API for StreamService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type StreamControllerClient interface { +type StreamServiceClient interface { CountStreamConnection(ctx context.Context, in *CountConnectionRequest, opts ...grpc.CallOption) (*CountConnectionResponse, error) PushStream(ctx context.Context, in *PushStreamRequest, opts ...grpc.CallOption) (*PushStreamResponse, error) PushStreamBatch(ctx context.Context, in *PushStreamBatchRequest, opts ...grpc.CallOption) (*PushStreamResponse, error) } -type streamControllerClient struct { +type streamServiceClient struct { cc grpc.ClientConnInterface } -func NewStreamControllerClient(cc grpc.ClientConnInterface) StreamControllerClient { - return &streamControllerClient{cc} +func NewStreamServiceClient(cc grpc.ClientConnInterface) StreamServiceClient { + return &streamServiceClient{cc} } -func (c *streamControllerClient) CountStreamConnection(ctx context.Context, in *CountConnectionRequest, opts ...grpc.CallOption) (*CountConnectionResponse, error) { +func (c *streamServiceClient) CountStreamConnection(ctx context.Context, in *CountConnectionRequest, opts ...grpc.CallOption) (*CountConnectionResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CountConnectionResponse) - err := c.cc.Invoke(ctx, StreamController_CountStreamConnection_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, StreamService_CountStreamConnection_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *streamControllerClient) PushStream(ctx context.Context, in *PushStreamRequest, opts ...grpc.CallOption) (*PushStreamResponse, error) { +func (c *streamServiceClient) PushStream(ctx context.Context, in *PushStreamRequest, opts ...grpc.CallOption) (*PushStreamResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PushStreamResponse) - err := c.cc.Invoke(ctx, StreamController_PushStream_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, StreamService_PushStream_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *streamControllerClient) PushStreamBatch(ctx context.Context, in *PushStreamBatchRequest, opts ...grpc.CallOption) (*PushStreamResponse, error) { +func (c *streamServiceClient) PushStreamBatch(ctx context.Context, in *PushStreamBatchRequest, opts ...grpc.CallOption) (*PushStreamResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PushStreamResponse) - err := c.cc.Invoke(ctx, StreamController_PushStreamBatch_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, StreamService_PushStreamBatch_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -// StreamControllerServer is the server API for StreamController service. -// All implementations must embed UnimplementedStreamControllerServer +// StreamServiceServer is the server API for StreamService service. +// All implementations must embed UnimplementedStreamServiceServer // for forward compatibility. -type StreamControllerServer interface { +type StreamServiceServer interface { CountStreamConnection(context.Context, *CountConnectionRequest) (*CountConnectionResponse, error) PushStream(context.Context, *PushStreamRequest) (*PushStreamResponse, error) PushStreamBatch(context.Context, *PushStreamBatchRequest) (*PushStreamResponse, error) - mustEmbedUnimplementedStreamControllerServer() + mustEmbedUnimplementedStreamServiceServer() } -// UnimplementedStreamControllerServer must be embedded to have +// UnimplementedStreamServiceServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. -type UnimplementedStreamControllerServer struct{} +type UnimplementedStreamServiceServer struct{} -func (UnimplementedStreamControllerServer) CountStreamConnection(context.Context, *CountConnectionRequest) (*CountConnectionResponse, error) { +func (UnimplementedStreamServiceServer) CountStreamConnection(context.Context, *CountConnectionRequest) (*CountConnectionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CountStreamConnection not implemented") } -func (UnimplementedStreamControllerServer) PushStream(context.Context, *PushStreamRequest) (*PushStreamResponse, error) { +func (UnimplementedStreamServiceServer) PushStream(context.Context, *PushStreamRequest) (*PushStreamResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PushStream not implemented") } -func (UnimplementedStreamControllerServer) PushStreamBatch(context.Context, *PushStreamBatchRequest) (*PushStreamResponse, error) { +func (UnimplementedStreamServiceServer) PushStreamBatch(context.Context, *PushStreamBatchRequest) (*PushStreamResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PushStreamBatch not implemented") } -func (UnimplementedStreamControllerServer) mustEmbedUnimplementedStreamControllerServer() {} -func (UnimplementedStreamControllerServer) testEmbeddedByValue() {} +func (UnimplementedStreamServiceServer) mustEmbedUnimplementedStreamServiceServer() {} +func (UnimplementedStreamServiceServer) testEmbeddedByValue() {} -// UnsafeStreamControllerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to StreamControllerServer will +// UnsafeStreamServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StreamServiceServer will // result in compilation errors. -type UnsafeStreamControllerServer interface { - mustEmbedUnimplementedStreamControllerServer() +type UnsafeStreamServiceServer interface { + mustEmbedUnimplementedStreamServiceServer() } -func RegisterStreamControllerServer(s grpc.ServiceRegistrar, srv StreamControllerServer) { - // If the following call pancis, it indicates UnimplementedStreamControllerServer was +func RegisterStreamServiceServer(s grpc.ServiceRegistrar, srv StreamServiceServer) { + // If the following call pancis, it indicates UnimplementedStreamServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } - s.RegisterService(&StreamController_ServiceDesc, srv) + s.RegisterService(&StreamService_ServiceDesc, srv) } -func _StreamController_CountStreamConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _StreamService_CountStreamConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CountConnectionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(StreamControllerServer).CountStreamConnection(ctx, in) + return srv.(StreamServiceServer).CountStreamConnection(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: StreamController_CountStreamConnection_FullMethodName, + FullMethod: StreamService_CountStreamConnection_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StreamControllerServer).CountStreamConnection(ctx, req.(*CountConnectionRequest)) + return srv.(StreamServiceServer).CountStreamConnection(ctx, req.(*CountConnectionRequest)) } return interceptor(ctx, in, info, handler) } -func _StreamController_PushStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _StreamService_PushStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PushStreamRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(StreamControllerServer).PushStream(ctx, in) + return srv.(StreamServiceServer).PushStream(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: StreamController_PushStream_FullMethodName, + FullMethod: StreamService_PushStream_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StreamControllerServer).PushStream(ctx, req.(*PushStreamRequest)) + return srv.(StreamServiceServer).PushStream(ctx, req.(*PushStreamRequest)) } return interceptor(ctx, in, info, handler) } -func _StreamController_PushStreamBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _StreamService_PushStreamBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PushStreamBatchRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(StreamControllerServer).PushStreamBatch(ctx, in) + return srv.(StreamServiceServer).PushStreamBatch(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: StreamController_PushStreamBatch_FullMethodName, + FullMethod: StreamService_PushStreamBatch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StreamControllerServer).PushStreamBatch(ctx, req.(*PushStreamBatchRequest)) + return srv.(StreamServiceServer).PushStreamBatch(ctx, req.(*PushStreamBatchRequest)) } return interceptor(ctx, in, info, handler) } -// StreamController_ServiceDesc is the grpc.ServiceDesc for StreamController service. +// StreamService_ServiceDesc is the grpc.ServiceDesc for StreamService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var StreamController_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "proto.StreamController", - HandlerType: (*StreamControllerServer)(nil), +var StreamService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.StreamService", + HandlerType: (*StreamServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CountStreamConnection", - Handler: _StreamController_CountStreamConnection_Handler, + Handler: _StreamService_CountStreamConnection_Handler, }, { MethodName: "PushStream", - Handler: _StreamController_PushStream_Handler, + Handler: _StreamService_PushStream_Handler, }, { MethodName: "PushStreamBatch", - Handler: _StreamController_PushStreamBatch_Handler, + Handler: _StreamService_PushStreamBatch_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/settings.toml b/settings.toml index e40f074..a4b3c27 100644 --- a/settings.toml +++ b/settings.toml @@ -27,5 +27,8 @@ aliases = { id = "auth", uc = "files", co = "interactive", im = "messaging" } dsn = "host=localhost user=postgres dbname=postgres password=password port=5432 sslmode=disable" prefix = "sn_" +[kv] +endpoints = ["localhost:2379"] + [scraper] user-agent = "SolarBot/1.0" \ No newline at end of file