diff --git a/BUILD.md b/BUILD.md index 959b6954bb..d259d62006 100644 --- a/BUILD.md +++ b/BUILD.md @@ -6,6 +6,15 @@ To build the binaries yourself, simply clone this repo and run make all ``` +To embed the webconsole, place the front-end code in `webconsole/dist`, and build with + +``` +make WEBCONSOLE=1 +``` + +This will add the Go build tag `webconsole` which will use the *statik* library to embed the +front-end code. The front-end will be then served in the web API root "/". + ## Linux (by component) ```bash diff --git a/Makefile b/Makefile index 1b74760dd7..a944dc2068 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,9 @@ V_LDFLAGS_COMMON := -s -X "github.com/codenotary/immudb/cmd/version.Version=$(VE V_LDFLAGS_STATIC := ${V_LDFLAGS_COMMON} \ -X github.com/codenotary/immudb/cmd/version.Static=static \ -extldflags "-static" +ifdef WEBCONSOLE + IMMUDB_BUILD_TAGS=-tags webconsole +endif .PHONY: all all: immudb immuclient immuadmin immutest @@ -46,6 +49,10 @@ all: immudb immuclient immuadmin immutest .PHONY: rebuild rebuild: clean build/codegen all +.PHONY: webconsole +webconsole: + $(GO) generate $(IMMUDB_BUILD_TAGS) ./webconsole + .PHONY: immuclient immuclient: $(GO) build -v -ldflags '$(V_LDFLAGS_COMMON)' ./cmd/immuclient @@ -55,8 +62,8 @@ immuadmin: $(GO) build -v -ldflags '$(V_LDFLAGS_COMMON)' ./cmd/immuadmin .PHONY: immudb -immudb: - $(GO) build -v -ldflags '$(V_LDFLAGS_COMMON)' ./cmd/immudb +immudb: webconsole + $(GO) build $(IMMUDB_BUILD_TAGS) -v -ldflags '$(V_LDFLAGS_COMMON)' ./cmd/immudb .PHONY: immutest immutest: @@ -64,19 +71,19 @@ immutest: .PHONY: immuclient-static immuclient-static: - CGO_ENABLED=0 $(GO) build -a -tags netgo -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immuclient + CGO_ENABLED=0 $(GO) build -a -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immuclient .PHONY: immuadmin-static immuadmin-static: - CGO_ENABLED=0 $(GO) build -a -tags netgo -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immuadmin + CGO_ENABLED=0 $(GO) build -a -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immuadmin .PHONY: immudb-static -immudb-static: - CGO_ENABLED=0 $(GO) build -a -tags netgo -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immudb +immudb-static: webconsole + CGO_ENABLED=0 $(GO) build $(IMMUDB_BUILD_TAGS) -a -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immudb .PHONY: immutest-static immutest-static: - CGO_ENABLED=0 $(GO) build -a -tags netgo -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immutest + CGO_ENABLED=0 $(GO) build -a -ldflags '$(V_LDFLAGS_STATIC) -extldflags "-static"' ./cmd/immutest .PHONY: vendor vendor: @@ -200,7 +207,7 @@ clean/dist: .PHONY: dist dist: clean/dist build/xgo mkdir -p dist - CGO_ENABLED=0 $(GO) build -a -tags netgo -ldflags '${V_LDFLAGS_STATIC}' \ + CGO_ENABLED=0 $(GO) build -a -ldflags '${V_LDFLAGS_STATIC}' \ -o ./dist/${SERVICE_NAME}-v${VERSION}-linux-amd64-static \ ./cmd/${SERVICE_NAME} $(DOCKER) run --rm \ diff --git a/cmd/immudb/command/init_windows.go b/cmd/immudb/command/init_windows.go index 922b826add..5cac1ce138 100644 --- a/cmd/immudb/command/init_windows.go +++ b/cmd/immudb/command/init_windows.go @@ -65,6 +65,9 @@ func parseOptions() (options *server.Options, err error) { synced := viper.GetBool("synced") tokenExpTime := viper.GetInt("token-expiry-time") + webServer := viper.GetBool("web-server") + webServerPort := viper.GetInt("web-server-port") + storeOpts := server.DefaultStoreOptions().WithSynced(synced) tlsConfig, err := setUpTLS(pkey, certificate, clientcas, mtls) @@ -89,7 +92,9 @@ func parseOptions() (options *server.Options, err error) { WithMaintenance(maintenance). WithSigningKey(signingKey). WithStoreOptions(storeOpts). - WithTokenExpiryTime(tokenExpTime) + WithTokenExpiryTime(tokenExpTime). + WithWebServer(webServer). + WithWebServerPort(webServerPort) return options, nil } @@ -115,6 +120,8 @@ func (cl *Commandline) setupFlags(cmd *cobra.Command, options *server.Options) { cmd.Flags().String("signingKey", options.SigningKey, "signature private key path. If a valid one is provided, it enables the cryptographic signature of the root. E.g. \"./../test/signer/ec3.key\"") cmd.Flags().Bool("synced", false, "synced mode prevents data lost under unexpected crashes but affects performance") cmd.Flags().Int("token-expiry-time", options.TokenExpiryTimeMin, "client authentication token expiration time. Minutes") + cmd.Flags().Bool("web-server", options.WebServer, "enable or disable web/console server") + cmd.Flags().Int("web-server-port", options.WebServerPort, "web/console server port") } func setupDefaults(options *server.Options) { @@ -136,4 +143,6 @@ func setupDefaults(options *server.Options) { viper.SetDefault("maintenance", options.GetMaintenance()) viper.SetDefault("synced", false) viper.SetDefault("token-expiry-time", options.TokenExpiryTimeMin) + viper.SetDefault("web-server", options.WebServer) + viper.SetDefault("web-server-port", options.WebServerPort) } diff --git a/go.mod b/go.mod index 20d34ce6c9..bb66f1798f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/fatih/color v1.9.0 github.com/gizak/termui/v3 v3.1.0 - github.com/golang/protobuf v1.4.3 + github.com/golang/protobuf v1.5.2 github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -17,8 +17,10 @@ require ( github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.9.1 github.com/pseudomuto/protoc-gen-doc v1.4.1 + github.com/rakyll/statik v0.1.7 github.com/rogpeppe/go-internal v1.6.2 github.com/rs/xid v1.2.1 + github.com/sirupsen/logrus v1.6.0 // indirect github.com/spf13/afero v1.3.4 // indirect github.com/spf13/cobra v1.0.0 github.com/spf13/viper v1.6.3 @@ -29,8 +31,8 @@ require ( golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d golang.org/x/text v0.3.4 // indirect google.golang.org/genproto v0.0.0-20201207150747-9ee31aac76e7 - google.golang.org/grpc v1.34.0 - google.golang.org/protobuf v1.25.0 + google.golang.org/grpc v1.37.0 + google.golang.org/protobuf v1.26.0 gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index a572c37ae0..1a6652399f 100644 --- a/go.sum +++ b/go.sum @@ -34,7 +34,7 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/codenotary/daemon v0.0.0-20200507161650-3d4bcb5230f4 h1:5mhTmqO2f6QXPlIAGCEtCYR2MHNDLVkwaGWiSbffeQU= github.com/codenotary/daemon v0.0.0-20200507161650-3d4bcb5230f4/go.mod h1:PFDPquCi+3LI5PpAKS/8LvJBHTfkdsEXfGtANGx9hH4= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -54,7 +54,7 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.3.0-java h1:bV5JGEB1ouEzZa0hgVDFFiClrUEuGWRaAc/3mxR2QK0= github.com/envoyproxy/protoc-gen-validate v0.3.0-java/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -89,15 +89,17 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= @@ -130,8 +132,9 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -208,6 +211,8 @@ github.com/pseudomuto/protoc-gen-doc v1.4.1 h1:aNTZq0dy0Pq2ag2v7bhNKFNgBBA8wMCoJ github.com/pseudomuto/protoc-gen-doc v1.4.1/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= +github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= +github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -220,8 +225,9 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= @@ -343,8 +349,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.34.0 h1:raiipEjMOIC/TO2AvyTxP25XFdLxNIBwzDh3FM3XztI= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -354,8 +360,10 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= 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= diff --git a/pkg/api/schema/schema.pb.go b/pkg/api/schema/schema.pb.go index d9bfdf9435..2dc0f966b8 100644 --- a/pkg/api/schema/schema.pb.go +++ b/pkg/api/schema/schema.pb.go @@ -15,17 +15,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.11.4 +// protoc-gen-go v1.26.0 +// protoc v3.14.0 // source: schema.proto package schema import ( context "context" - proto "github.com/golang/protobuf/proto" - empty "github.com/golang/protobuf/ptypes/empty" - _struct "github.com/golang/protobuf/ptypes/struct" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" @@ -33,6 +30,8 @@ import ( status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" ) @@ -44,10 +43,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type PermissionAction int32 const ( @@ -3971,11 +3966,11 @@ func (m *SQLValue) GetValue() isSQLValue_Value { return nil } -func (x *SQLValue) GetNull() _struct.NullValue { +func (x *SQLValue) GetNull() structpb.NullValue { if x, ok := x.GetValue().(*SQLValue_Null); ok { return x.Null } - return _struct.NullValue_NULL_VALUE + return structpb.NullValue_NULL_VALUE } func (x *SQLValue) GetN() uint64 { @@ -4011,7 +4006,7 @@ type isSQLValue_Value interface { } type SQLValue_Null struct { - Null _struct.NullValue `protobuf:"varint,1,opt,name=null,proto3,enum=google.protobuf.NullValue,oneof"` + Null structpb.NullValue `protobuf:"varint,1,opt,name=null,proto3,enum=google.protobuf.NullValue,oneof"` } type SQLValue_N struct { @@ -4454,7 +4449,7 @@ var file_schema_proto_rawDesc = []byte{ 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x02, 0x62, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x29, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x41, 0x4e, 0x54, 0x10, - 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x56, 0x4f, 0x4b, 0x45, 0x10, 0x01, 0x32, 0xa0, 0x1f, + 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x56, 0x4f, 0x4b, 0x45, 0x10, 0x01, 0x32, 0xf8, 0x1f, 0x0a, 0x0b, 0x49, 0x6d, 0x6d, 0x75, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, @@ -4686,51 +4681,56 @@ var file_schema_proto_rawDesc = []byte{ 0x65, 0x63, 0x41, 0x6c, 0x6c, 0x12, 0x14, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0x19, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x78, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x00, 0x28, 0x01, 0x12, 0x48, 0x0a, 0x07, 0x53, 0x51, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x00, 0x28, 0x01, 0x12, 0x5e, 0x0a, 0x07, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1d, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x51, 0x4c, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x08, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x12, 0x1e, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x2e, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1d, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x2e, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, - 0x00, 0x12, 0x45, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, - 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0d, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x2e, 0x69, 0x6d, 0x6d, 0x75, - 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x1a, - 0x1d, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, - 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, - 0x42, 0x8b, 0x03, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x63, 0x6f, 0x64, 0x65, 0x6e, 0x6f, 0x74, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6d, 0x6d, 0x75, 0x64, - 0x62, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x92, 0x41, 0xda, 0x02, 0x12, 0xee, 0x01, 0x0a, 0x0f, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x20, - 0x52, 0x45, 0x53, 0x54, 0x20, 0x41, 0x50, 0x49, 0x12, 0xda, 0x01, 0x3c, 0x62, 0x3e, 0x49, 0x4d, - 0x50, 0x4f, 0x52, 0x54, 0x41, 0x4e, 0x54, 0x3c, 0x2f, 0x62, 0x3e, 0x3a, 0x20, 0x41, 0x6c, 0x6c, - 0x20, 0x3c, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x67, 0x65, 0x74, 0x3c, 0x2f, 0x63, 0x6f, 0x64, 0x65, - 0x3e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x3c, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x73, 0x61, 0x66, 0x65, - 0x67, 0x65, 0x74, 0x3c, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x3c, 0x75, 0x3e, 0x62, - 0x61, 0x73, 0x65, 0x36, 0x34, 0x2d, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x3c, 0x2f, 0x75, - 0x3e, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x3c, 0x63, 0x6f, - 0x64, 0x65, 0x3e, 0x73, 0x65, 0x74, 0x3c, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x20, 0x61, 0x6e, - 0x64, 0x20, 0x3c, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x73, 0x61, 0x66, 0x65, 0x73, 0x65, 0x74, 0x3c, - 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x20, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x20, 0x3c, 0x75, 0x3e, 0x62, 0x61, 0x73, 0x65, 0x36, - 0x34, 0x2d, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x3c, 0x2f, 0x75, 0x3e, 0x20, 0x69, 0x6e, - 0x70, 0x75, 0x74, 0x73, 0x2e, 0x5a, 0x59, 0x0a, 0x57, 0x0a, 0x06, 0x62, 0x65, 0x61, 0x72, 0x65, - 0x72, 0x12, 0x4d, 0x08, 0x02, 0x12, 0x38, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2c, 0x20, 0x70, 0x72, 0x65, - 0x66, 0x69, 0x78, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x3a, - 0x20, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x20, 0x3c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3e, 0x1a, - 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, - 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x74, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x22, 0x0b, 0x2f, 0x64, 0x62, 0x2f, + 0x73, 0x71, 0x6c, 0x65, 0x78, 0x65, 0x63, 0x3a, 0x01, 0x2a, 0x12, 0x62, 0x0a, 0x08, 0x53, 0x51, + 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1e, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x22, 0x0c, 0x2f, + 0x64, 0x62, 0x2f, 0x73, 0x71, 0x6c, 0x71, 0x75, 0x65, 0x72, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x5b, + 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x64, 0x62, + 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x5b, 0x0a, 0x0d, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x2e, 0x69, + 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x61, 0x62, + 0x6c, 0x65, 0x1a, 0x1d, 0x2e, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2e, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x2e, 0x53, 0x51, 0x4c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x22, 0x0a, 0x2f, 0x64, 0x62, 0x2f, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x42, 0x8b, 0x03, 0x5a, 0x2b, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x6e, 0x6f, 0x74, 0x61, + 0x72, 0x79, 0x2f, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x92, 0x41, 0xda, 0x02, 0x12, 0xee, 0x01, 0x0a, + 0x0f, 0x69, 0x6d, 0x6d, 0x75, 0x64, 0x62, 0x20, 0x52, 0x45, 0x53, 0x54, 0x20, 0x41, 0x50, 0x49, + 0x12, 0xda, 0x01, 0x3c, 0x62, 0x3e, 0x49, 0x4d, 0x50, 0x4f, 0x52, 0x54, 0x41, 0x4e, 0x54, 0x3c, + 0x2f, 0x62, 0x3e, 0x3a, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x3c, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x67, + 0x65, 0x74, 0x3c, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x3c, 0x63, + 0x6f, 0x64, 0x65, 0x3e, 0x73, 0x61, 0x66, 0x65, 0x67, 0x65, 0x74, 0x3c, 0x2f, 0x63, 0x6f, 0x64, + 0x65, 0x3e, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x72, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x20, 0x3c, 0x75, 0x3e, 0x62, 0x61, 0x73, 0x65, 0x36, 0x34, 0x2d, 0x65, 0x6e, + 0x63, 0x6f, 0x64, 0x65, 0x64, 0x3c, 0x2f, 0x75, 0x3e, 0x20, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x61, + 0x6e, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x6c, 0x65, + 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x3c, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x73, 0x65, 0x74, 0x3c, 0x2f, + 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x3c, 0x63, 0x6f, 0x64, 0x65, 0x3e, + 0x73, 0x61, 0x66, 0x65, 0x73, 0x65, 0x74, 0x3c, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x3e, 0x20, 0x66, + 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x20, + 0x3c, 0x75, 0x3e, 0x62, 0x61, 0x73, 0x65, 0x36, 0x34, 0x2d, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x64, 0x3c, 0x2f, 0x75, 0x3e, 0x20, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x2e, 0x5a, 0x59, 0x0a, + 0x57, 0x0a, 0x06, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x4d, 0x08, 0x02, 0x12, 0x38, 0x41, + 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x2c, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x64, 0x20, 0x62, 0x79, + 0x20, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x3a, 0x20, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x20, + 0x3c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3e, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x62, 0x65, + 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4813,8 +4813,8 @@ var file_schema_proto_goTypes = []interface{}{ (*Column)(nil), // 62: immudb.schema.Column (*Row)(nil), // 63: immudb.schema.Row (*SQLValue)(nil), // 64: immudb.schema.SQLValue - (_struct.NullValue)(0), // 65: google.protobuf.NullValue - (*empty.Empty)(nil), // 66: google.protobuf.Empty + (structpb.NullValue)(0), // 65: google.protobuf.NullValue + (*emptypb.Empty)(nil), // 66: google.protobuf.Empty } var file_schema_proto_depIdxs = []int32{ 2, // 0: immudb.schema.User.permissions:type_name -> immudb.schema.Permission @@ -5775,13 +5775,13 @@ const _ = grpc.SupportPackageIsVersion6 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ImmuServiceClient interface { - ListUsers(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*UserList, error) - CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*empty.Empty, error) - ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*empty.Empty, error) - UpdateAuthConfig(ctx context.Context, in *AuthConfig, opts ...grpc.CallOption) (*empty.Empty, error) - UpdateMTLSConfig(ctx context.Context, in *MTLSConfig, opts ...grpc.CallOption) (*empty.Empty, error) + ListUsers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserList, error) + CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + UpdateAuthConfig(ctx context.Context, in *AuthConfig, opts ...grpc.CallOption) (*emptypb.Empty, error) + UpdateMTLSConfig(ctx context.Context, in *MTLSConfig, opts ...grpc.CallOption) (*emptypb.Empty, error) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) - Logout(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) + Logout(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*TxMetadata, error) VerifiableSet(ctx context.Context, in *VerifiableSetRequest, opts ...grpc.CallOption) (*VerifiableTx, error) Get(ctx context.Context, in *KeyRequest, opts ...grpc.CallOption) (*Entry, error) @@ -5790,24 +5790,24 @@ type ImmuServiceClient interface { ExecAll(ctx context.Context, in *ExecAllRequest, opts ...grpc.CallOption) (*TxMetadata, error) Scan(ctx context.Context, in *ScanRequest, opts ...grpc.CallOption) (*Entries, error) Count(ctx context.Context, in *KeyPrefix, opts ...grpc.CallOption) (*EntryCount, error) - CountAll(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*EntryCount, error) + CountAll(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*EntryCount, error) TxById(ctx context.Context, in *TxRequest, opts ...grpc.CallOption) (*Tx, error) VerifiableTxById(ctx context.Context, in *VerifiableTxRequest, opts ...grpc.CallOption) (*VerifiableTx, error) TxScan(ctx context.Context, in *TxScanRequest, opts ...grpc.CallOption) (*TxList, error) History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*Entries, error) - Health(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*HealthResponse, error) - CurrentState(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImmutableState, error) + Health(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*HealthResponse, error) + CurrentState(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ImmutableState, error) SetReference(ctx context.Context, in *ReferenceRequest, opts ...grpc.CallOption) (*TxMetadata, error) VerifiableSetReference(ctx context.Context, in *VerifiableReferenceRequest, opts ...grpc.CallOption) (*VerifiableTx, error) ZAdd(ctx context.Context, in *ZAddRequest, opts ...grpc.CallOption) (*TxMetadata, error) VerifiableZAdd(ctx context.Context, in *VerifiableZAddRequest, opts ...grpc.CallOption) (*VerifiableTx, error) ZScan(ctx context.Context, in *ZScanRequest, opts ...grpc.CallOption) (*ZEntries, error) - CreateDatabase(ctx context.Context, in *Database, opts ...grpc.CallOption) (*empty.Empty, error) - DatabaseList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DatabaseListResponse, error) + CreateDatabase(ctx context.Context, in *Database, opts ...grpc.CallOption) (*emptypb.Empty, error) + DatabaseList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DatabaseListResponse, error) UseDatabase(ctx context.Context, in *Database, opts ...grpc.CallOption) (*UseDatabaseReply, error) - CleanIndex(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) - ChangePermission(ctx context.Context, in *ChangePermissionRequest, opts ...grpc.CallOption) (*empty.Empty, error) - SetActiveUser(ctx context.Context, in *SetActiveUserRequest, opts ...grpc.CallOption) (*empty.Empty, error) + CleanIndex(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) + ChangePermission(ctx context.Context, in *ChangePermissionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + SetActiveUser(ctx context.Context, in *SetActiveUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // Streams StreamGet(ctx context.Context, in *KeyRequest, opts ...grpc.CallOption) (ImmuService_StreamGetClient, error) StreamSet(ctx context.Context, opts ...grpc.CallOption) (ImmuService_StreamSetClient, error) @@ -5820,7 +5820,7 @@ type ImmuServiceClient interface { // SQL SQLExec(ctx context.Context, in *SQLExecRequest, opts ...grpc.CallOption) (*SQLExecResult, error) SQLQuery(ctx context.Context, in *SQLQueryRequest, opts ...grpc.CallOption) (*SQLQueryResult, error) - ListTables(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SQLQueryResult, error) + ListTables(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SQLQueryResult, error) DescribeTable(ctx context.Context, in *Table, opts ...grpc.CallOption) (*SQLQueryResult, error) } @@ -5832,7 +5832,7 @@ func NewImmuServiceClient(cc grpc.ClientConnInterface) ImmuServiceClient { return &immuServiceClient{cc} } -func (c *immuServiceClient) ListUsers(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*UserList, error) { +func (c *immuServiceClient) ListUsers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserList, error) { out := new(UserList) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/ListUsers", in, out, opts...) if err != nil { @@ -5841,8 +5841,8 @@ func (c *immuServiceClient) ListUsers(ctx context.Context, in *empty.Empty, opts return out, nil } -func (c *immuServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/CreateUser", in, out, opts...) if err != nil { return nil, err @@ -5850,8 +5850,8 @@ func (c *immuServiceClient) CreateUser(ctx context.Context, in *CreateUserReques return out, nil } -func (c *immuServiceClient) ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/ChangePassword", in, out, opts...) if err != nil { return nil, err @@ -5859,8 +5859,8 @@ func (c *immuServiceClient) ChangePassword(ctx context.Context, in *ChangePasswo return out, nil } -func (c *immuServiceClient) UpdateAuthConfig(ctx context.Context, in *AuthConfig, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) UpdateAuthConfig(ctx context.Context, in *AuthConfig, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/UpdateAuthConfig", in, out, opts...) if err != nil { return nil, err @@ -5868,8 +5868,8 @@ func (c *immuServiceClient) UpdateAuthConfig(ctx context.Context, in *AuthConfig return out, nil } -func (c *immuServiceClient) UpdateMTLSConfig(ctx context.Context, in *MTLSConfig, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) UpdateMTLSConfig(ctx context.Context, in *MTLSConfig, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/UpdateMTLSConfig", in, out, opts...) if err != nil { return nil, err @@ -5886,8 +5886,8 @@ func (c *immuServiceClient) Login(ctx context.Context, in *LoginRequest, opts .. return out, nil } -func (c *immuServiceClient) Logout(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) Logout(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/Logout", in, out, opts...) if err != nil { return nil, err @@ -5967,7 +5967,7 @@ func (c *immuServiceClient) Count(ctx context.Context, in *KeyPrefix, opts ...gr return out, nil } -func (c *immuServiceClient) CountAll(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*EntryCount, error) { +func (c *immuServiceClient) CountAll(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*EntryCount, error) { out := new(EntryCount) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/CountAll", in, out, opts...) if err != nil { @@ -6012,7 +6012,7 @@ func (c *immuServiceClient) History(ctx context.Context, in *HistoryRequest, opt return out, nil } -func (c *immuServiceClient) Health(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*HealthResponse, error) { +func (c *immuServiceClient) Health(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*HealthResponse, error) { out := new(HealthResponse) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/Health", in, out, opts...) if err != nil { @@ -6021,7 +6021,7 @@ func (c *immuServiceClient) Health(ctx context.Context, in *empty.Empty, opts .. return out, nil } -func (c *immuServiceClient) CurrentState(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImmutableState, error) { +func (c *immuServiceClient) CurrentState(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ImmutableState, error) { out := new(ImmutableState) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/CurrentState", in, out, opts...) if err != nil { @@ -6075,8 +6075,8 @@ func (c *immuServiceClient) ZScan(ctx context.Context, in *ZScanRequest, opts .. return out, nil } -func (c *immuServiceClient) CreateDatabase(ctx context.Context, in *Database, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) CreateDatabase(ctx context.Context, in *Database, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/CreateDatabase", in, out, opts...) if err != nil { return nil, err @@ -6084,7 +6084,7 @@ func (c *immuServiceClient) CreateDatabase(ctx context.Context, in *Database, op return out, nil } -func (c *immuServiceClient) DatabaseList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*DatabaseListResponse, error) { +func (c *immuServiceClient) DatabaseList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DatabaseListResponse, error) { out := new(DatabaseListResponse) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/DatabaseList", in, out, opts...) if err != nil { @@ -6102,8 +6102,8 @@ func (c *immuServiceClient) UseDatabase(ctx context.Context, in *Database, opts return out, nil } -func (c *immuServiceClient) CleanIndex(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) CleanIndex(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/CleanIndex", in, out, opts...) if err != nil { return nil, err @@ -6111,8 +6111,8 @@ func (c *immuServiceClient) CleanIndex(ctx context.Context, in *empty.Empty, opt return out, nil } -func (c *immuServiceClient) ChangePermission(ctx context.Context, in *ChangePermissionRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) ChangePermission(ctx context.Context, in *ChangePermissionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/ChangePermission", in, out, opts...) if err != nil { return nil, err @@ -6120,8 +6120,8 @@ func (c *immuServiceClient) ChangePermission(ctx context.Context, in *ChangePerm return out, nil } -func (c *immuServiceClient) SetActiveUser(ctx context.Context, in *SetActiveUserRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *immuServiceClient) SetActiveUser(ctx context.Context, in *SetActiveUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/SetActiveUser", in, out, opts...) if err != nil { return nil, err @@ -6409,7 +6409,7 @@ func (c *immuServiceClient) SQLQuery(ctx context.Context, in *SQLQueryRequest, o return out, nil } -func (c *immuServiceClient) ListTables(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SQLQueryResult, error) { +func (c *immuServiceClient) ListTables(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SQLQueryResult, error) { out := new(SQLQueryResult) err := c.cc.Invoke(ctx, "/immudb.schema.ImmuService/ListTables", in, out, opts...) if err != nil { @@ -6429,13 +6429,13 @@ func (c *immuServiceClient) DescribeTable(ctx context.Context, in *Table, opts . // ImmuServiceServer is the server API for ImmuService service. type ImmuServiceServer interface { - ListUsers(context.Context, *empty.Empty) (*UserList, error) - CreateUser(context.Context, *CreateUserRequest) (*empty.Empty, error) - ChangePassword(context.Context, *ChangePasswordRequest) (*empty.Empty, error) - UpdateAuthConfig(context.Context, *AuthConfig) (*empty.Empty, error) - UpdateMTLSConfig(context.Context, *MTLSConfig) (*empty.Empty, error) + ListUsers(context.Context, *emptypb.Empty) (*UserList, error) + CreateUser(context.Context, *CreateUserRequest) (*emptypb.Empty, error) + ChangePassword(context.Context, *ChangePasswordRequest) (*emptypb.Empty, error) + UpdateAuthConfig(context.Context, *AuthConfig) (*emptypb.Empty, error) + UpdateMTLSConfig(context.Context, *MTLSConfig) (*emptypb.Empty, error) Login(context.Context, *LoginRequest) (*LoginResponse, error) - Logout(context.Context, *empty.Empty) (*empty.Empty, error) + Logout(context.Context, *emptypb.Empty) (*emptypb.Empty, error) Set(context.Context, *SetRequest) (*TxMetadata, error) VerifiableSet(context.Context, *VerifiableSetRequest) (*VerifiableTx, error) Get(context.Context, *KeyRequest) (*Entry, error) @@ -6444,24 +6444,24 @@ type ImmuServiceServer interface { ExecAll(context.Context, *ExecAllRequest) (*TxMetadata, error) Scan(context.Context, *ScanRequest) (*Entries, error) Count(context.Context, *KeyPrefix) (*EntryCount, error) - CountAll(context.Context, *empty.Empty) (*EntryCount, error) + CountAll(context.Context, *emptypb.Empty) (*EntryCount, error) TxById(context.Context, *TxRequest) (*Tx, error) VerifiableTxById(context.Context, *VerifiableTxRequest) (*VerifiableTx, error) TxScan(context.Context, *TxScanRequest) (*TxList, error) History(context.Context, *HistoryRequest) (*Entries, error) - Health(context.Context, *empty.Empty) (*HealthResponse, error) - CurrentState(context.Context, *empty.Empty) (*ImmutableState, error) + Health(context.Context, *emptypb.Empty) (*HealthResponse, error) + CurrentState(context.Context, *emptypb.Empty) (*ImmutableState, error) SetReference(context.Context, *ReferenceRequest) (*TxMetadata, error) VerifiableSetReference(context.Context, *VerifiableReferenceRequest) (*VerifiableTx, error) ZAdd(context.Context, *ZAddRequest) (*TxMetadata, error) VerifiableZAdd(context.Context, *VerifiableZAddRequest) (*VerifiableTx, error) ZScan(context.Context, *ZScanRequest) (*ZEntries, error) - CreateDatabase(context.Context, *Database) (*empty.Empty, error) - DatabaseList(context.Context, *empty.Empty) (*DatabaseListResponse, error) + CreateDatabase(context.Context, *Database) (*emptypb.Empty, error) + DatabaseList(context.Context, *emptypb.Empty) (*DatabaseListResponse, error) UseDatabase(context.Context, *Database) (*UseDatabaseReply, error) - CleanIndex(context.Context, *empty.Empty) (*empty.Empty, error) - ChangePermission(context.Context, *ChangePermissionRequest) (*empty.Empty, error) - SetActiveUser(context.Context, *SetActiveUserRequest) (*empty.Empty, error) + CleanIndex(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + ChangePermission(context.Context, *ChangePermissionRequest) (*emptypb.Empty, error) + SetActiveUser(context.Context, *SetActiveUserRequest) (*emptypb.Empty, error) // Streams StreamGet(*KeyRequest, ImmuService_StreamGetServer) error StreamSet(ImmuService_StreamSetServer) error @@ -6474,7 +6474,7 @@ type ImmuServiceServer interface { // SQL SQLExec(context.Context, *SQLExecRequest) (*SQLExecResult, error) SQLQuery(context.Context, *SQLQueryRequest) (*SQLQueryResult, error) - ListTables(context.Context, *empty.Empty) (*SQLQueryResult, error) + ListTables(context.Context, *emptypb.Empty) (*SQLQueryResult, error) DescribeTable(context.Context, *Table) (*SQLQueryResult, error) } @@ -6482,25 +6482,25 @@ type ImmuServiceServer interface { type UnimplementedImmuServiceServer struct { } -func (*UnimplementedImmuServiceServer) ListUsers(context.Context, *empty.Empty) (*UserList, error) { +func (*UnimplementedImmuServiceServer) ListUsers(context.Context, *emptypb.Empty) (*UserList, error) { return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented") } -func (*UnimplementedImmuServiceServer) CreateUser(context.Context, *CreateUserRequest) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) CreateUser(context.Context, *CreateUserRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") } -func (*UnimplementedImmuServiceServer) ChangePassword(context.Context, *ChangePasswordRequest) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) ChangePassword(context.Context, *ChangePasswordRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ChangePassword not implemented") } -func (*UnimplementedImmuServiceServer) UpdateAuthConfig(context.Context, *AuthConfig) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) UpdateAuthConfig(context.Context, *AuthConfig) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateAuthConfig not implemented") } -func (*UnimplementedImmuServiceServer) UpdateMTLSConfig(context.Context, *MTLSConfig) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) UpdateMTLSConfig(context.Context, *MTLSConfig) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateMTLSConfig not implemented") } func (*UnimplementedImmuServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") } -func (*UnimplementedImmuServiceServer) Logout(context.Context, *empty.Empty) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) Logout(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") } func (*UnimplementedImmuServiceServer) Set(context.Context, *SetRequest) (*TxMetadata, error) { @@ -6527,7 +6527,7 @@ func (*UnimplementedImmuServiceServer) Scan(context.Context, *ScanRequest) (*Ent func (*UnimplementedImmuServiceServer) Count(context.Context, *KeyPrefix) (*EntryCount, error) { return nil, status.Errorf(codes.Unimplemented, "method Count not implemented") } -func (*UnimplementedImmuServiceServer) CountAll(context.Context, *empty.Empty) (*EntryCount, error) { +func (*UnimplementedImmuServiceServer) CountAll(context.Context, *emptypb.Empty) (*EntryCount, error) { return nil, status.Errorf(codes.Unimplemented, "method CountAll not implemented") } func (*UnimplementedImmuServiceServer) TxById(context.Context, *TxRequest) (*Tx, error) { @@ -6542,10 +6542,10 @@ func (*UnimplementedImmuServiceServer) TxScan(context.Context, *TxScanRequest) ( func (*UnimplementedImmuServiceServer) History(context.Context, *HistoryRequest) (*Entries, error) { return nil, status.Errorf(codes.Unimplemented, "method History not implemented") } -func (*UnimplementedImmuServiceServer) Health(context.Context, *empty.Empty) (*HealthResponse, error) { +func (*UnimplementedImmuServiceServer) Health(context.Context, *emptypb.Empty) (*HealthResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Health not implemented") } -func (*UnimplementedImmuServiceServer) CurrentState(context.Context, *empty.Empty) (*ImmutableState, error) { +func (*UnimplementedImmuServiceServer) CurrentState(context.Context, *emptypb.Empty) (*ImmutableState, error) { return nil, status.Errorf(codes.Unimplemented, "method CurrentState not implemented") } func (*UnimplementedImmuServiceServer) SetReference(context.Context, *ReferenceRequest) (*TxMetadata, error) { @@ -6563,22 +6563,22 @@ func (*UnimplementedImmuServiceServer) VerifiableZAdd(context.Context, *Verifiab func (*UnimplementedImmuServiceServer) ZScan(context.Context, *ZScanRequest) (*ZEntries, error) { return nil, status.Errorf(codes.Unimplemented, "method ZScan not implemented") } -func (*UnimplementedImmuServiceServer) CreateDatabase(context.Context, *Database) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) CreateDatabase(context.Context, *Database) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateDatabase not implemented") } -func (*UnimplementedImmuServiceServer) DatabaseList(context.Context, *empty.Empty) (*DatabaseListResponse, error) { +func (*UnimplementedImmuServiceServer) DatabaseList(context.Context, *emptypb.Empty) (*DatabaseListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DatabaseList not implemented") } func (*UnimplementedImmuServiceServer) UseDatabase(context.Context, *Database) (*UseDatabaseReply, error) { return nil, status.Errorf(codes.Unimplemented, "method UseDatabase not implemented") } -func (*UnimplementedImmuServiceServer) CleanIndex(context.Context, *empty.Empty) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) CleanIndex(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CleanIndex not implemented") } -func (*UnimplementedImmuServiceServer) ChangePermission(context.Context, *ChangePermissionRequest) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) ChangePermission(context.Context, *ChangePermissionRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ChangePermission not implemented") } -func (*UnimplementedImmuServiceServer) SetActiveUser(context.Context, *SetActiveUserRequest) (*empty.Empty, error) { +func (*UnimplementedImmuServiceServer) SetActiveUser(context.Context, *SetActiveUserRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method SetActiveUser not implemented") } func (*UnimplementedImmuServiceServer) StreamGet(*KeyRequest, ImmuService_StreamGetServer) error { @@ -6611,7 +6611,7 @@ func (*UnimplementedImmuServiceServer) SQLExec(context.Context, *SQLExecRequest) func (*UnimplementedImmuServiceServer) SQLQuery(context.Context, *SQLQueryRequest) (*SQLQueryResult, error) { return nil, status.Errorf(codes.Unimplemented, "method SQLQuery not implemented") } -func (*UnimplementedImmuServiceServer) ListTables(context.Context, *empty.Empty) (*SQLQueryResult, error) { +func (*UnimplementedImmuServiceServer) ListTables(context.Context, *emptypb.Empty) (*SQLQueryResult, error) { return nil, status.Errorf(codes.Unimplemented, "method ListTables not implemented") } func (*UnimplementedImmuServiceServer) DescribeTable(context.Context, *Table) (*SQLQueryResult, error) { @@ -6623,7 +6623,7 @@ func RegisterImmuServiceServer(s *grpc.Server, srv ImmuServiceServer) { } func _ImmuService_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -6635,7 +6635,7 @@ func _ImmuService_ListUsers_Handler(srv interface{}, ctx context.Context, dec fu FullMethod: "/immudb.schema.ImmuService/ListUsers", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).ListUsers(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).ListUsers(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -6731,7 +6731,7 @@ func _ImmuService_Login_Handler(srv interface{}, ctx context.Context, dec func(i } func _ImmuService_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -6743,7 +6743,7 @@ func _ImmuService_Logout_Handler(srv interface{}, ctx context.Context, dec func( FullMethod: "/immudb.schema.ImmuService/Logout", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).Logout(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).Logout(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -6893,7 +6893,7 @@ func _ImmuService_Count_Handler(srv interface{}, ctx context.Context, dec func(i } func _ImmuService_CountAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -6905,7 +6905,7 @@ func _ImmuService_CountAll_Handler(srv interface{}, ctx context.Context, dec fun FullMethod: "/immudb.schema.ImmuService/CountAll", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).CountAll(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).CountAll(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -6983,7 +6983,7 @@ func _ImmuService_History_Handler(srv interface{}, ctx context.Context, dec func } func _ImmuService_Health_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -6995,13 +6995,13 @@ func _ImmuService_Health_Handler(srv interface{}, ctx context.Context, dec func( FullMethod: "/immudb.schema.ImmuService/Health", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).Health(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).Health(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } func _ImmuService_CurrentState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -7013,7 +7013,7 @@ func _ImmuService_CurrentState_Handler(srv interface{}, ctx context.Context, dec FullMethod: "/immudb.schema.ImmuService/CurrentState", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).CurrentState(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).CurrentState(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -7127,7 +7127,7 @@ func _ImmuService_CreateDatabase_Handler(srv interface{}, ctx context.Context, d } func _ImmuService_DatabaseList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -7139,7 +7139,7 @@ func _ImmuService_DatabaseList_Handler(srv interface{}, ctx context.Context, dec FullMethod: "/immudb.schema.ImmuService/DatabaseList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).DatabaseList(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).DatabaseList(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -7163,7 +7163,7 @@ func _ImmuService_UseDatabase_Handler(srv interface{}, ctx context.Context, dec } func _ImmuService_CleanIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -7175,7 +7175,7 @@ func _ImmuService_CleanIndex_Handler(srv interface{}, ctx context.Context, dec f FullMethod: "/immudb.schema.ImmuService/CleanIndex", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).CleanIndex(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).CleanIndex(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -7436,7 +7436,7 @@ func _ImmuService_SQLQuery_Handler(srv interface{}, ctx context.Context, dec fun } func _ImmuService_ListTables_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) + in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } @@ -7448,7 +7448,7 @@ func _ImmuService_ListTables_Handler(srv interface{}, ctx context.Context, dec f FullMethod: "/immudb.schema.ImmuService/ListTables", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImmuServiceServer).ListTables(ctx, req.(*empty.Empty)) + return srv.(ImmuServiceServer).ListTables(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } diff --git a/pkg/api/schema/schema.pb.gw.go b/pkg/api/schema/schema.pb.gw.go index 897cf3c2ff..52b7e787b9 100644 --- a/pkg/api/schema/schema.pb.gw.go +++ b/pkg/api/schema/schema.pb.gw.go @@ -15,7 +15,6 @@ import ( "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/empty" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" "google.golang.org/grpc" @@ -23,6 +22,7 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" ) // Suppress "imported and not used" errors @@ -35,7 +35,7 @@ var _ = descriptor.ForMessage var _ = metadata.Join func request_ImmuService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.ListUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -44,7 +44,7 @@ func request_ImmuService_ListUsers_0(ctx context.Context, marshaler runtime.Mars } func local_request_ImmuService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.ListUsers(ctx, &protoReq) @@ -155,7 +155,7 @@ func local_request_ImmuService_Login_0(ctx context.Context, marshaler runtime.Ma } func request_ImmuService_Logout_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -172,7 +172,7 @@ func request_ImmuService_Logout_0(ctx context.Context, marshaler runtime.Marshal } func local_request_ImmuService_Logout_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -519,7 +519,7 @@ func local_request_ImmuService_Count_0(ctx context.Context, marshaler runtime.Ma } func request_ImmuService_CountAll_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.CountAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -528,7 +528,7 @@ func request_ImmuService_CountAll_0(ctx context.Context, marshaler runtime.Marsh } func local_request_ImmuService_CountAll_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.CountAll(ctx, &protoReq) @@ -731,7 +731,7 @@ func local_request_ImmuService_History_0(ctx context.Context, marshaler runtime. } func request_ImmuService_Health_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.Health(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -740,7 +740,7 @@ func request_ImmuService_Health_0(ctx context.Context, marshaler runtime.Marshal } func local_request_ImmuService_Health_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.Health(ctx, &protoReq) @@ -749,7 +749,7 @@ func local_request_ImmuService_Health_0(ctx context.Context, marshaler runtime.M } func request_ImmuService_CurrentState_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.CurrentState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -758,7 +758,7 @@ func request_ImmuService_CurrentState_0(ctx context.Context, marshaler runtime.M } func local_request_ImmuService_CurrentState_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.CurrentState(ctx, &protoReq) @@ -971,7 +971,7 @@ func local_request_ImmuService_CreateDatabase_0(ctx context.Context, marshaler r } func request_ImmuService_DatabaseList_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -988,7 +988,7 @@ func request_ImmuService_DatabaseList_0(ctx context.Context, marshaler runtime.M } func local_request_ImmuService_DatabaseList_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -1059,7 +1059,7 @@ func local_request_ImmuService_UseDatabase_0(ctx context.Context, marshaler runt } func request_ImmuService_CleanIndex_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := client.CleanIndex(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -1068,7 +1068,7 @@ func request_ImmuService_CleanIndex_0(ctx context.Context, marshaler runtime.Mar } func local_request_ImmuService_CleanIndex_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq empty.Empty + var protoReq emptypb.Empty var metadata runtime.ServerMetadata msg, err := server.CleanIndex(ctx, &protoReq) @@ -1144,6 +1144,126 @@ func local_request_ImmuService_SetActiveUser_0(ctx context.Context, marshaler ru } +func request_ImmuService_SQLExec_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SQLExecRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SQLExec(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ImmuService_SQLExec_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SQLExecRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SQLExec(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ImmuService_SQLQuery_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SQLQueryRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SQLQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ImmuService_SQLQuery_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SQLQueryRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SQLQuery(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ImmuService_ListTables_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := client.ListTables(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ImmuService_ListTables_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq emptypb.Empty + var metadata runtime.ServerMetadata + + msg, err := server.ListTables(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ImmuService_DescribeTable_0(ctx context.Context, marshaler runtime.Marshaler, client ImmuServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Table + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DescribeTable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ImmuService_DescribeTable_0(ctx context.Context, marshaler runtime.Marshaler, server ImmuServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Table + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DescribeTable(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterImmuServiceHandlerServer registers the http handlers for service ImmuService to "mux". // UnaryRPC :call ImmuServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1863,6 +1983,98 @@ func RegisterImmuServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_ImmuService_SQLExec_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ImmuService_SQLExec_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_SQLExec_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ImmuService_SQLQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ImmuService_SQLQuery_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_SQLQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ImmuService_ListTables_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ImmuService_ListTables_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_ListTables_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ImmuService_DescribeTable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ImmuService_DescribeTable_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_DescribeTable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -2524,6 +2736,86 @@ func RegisterImmuServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("POST", pattern_ImmuService_SQLExec_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ImmuService_SQLExec_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_SQLExec_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ImmuService_SQLQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ImmuService_SQLQuery_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_SQLQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ImmuService_ListTables_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ImmuService_ListTables_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_ListTables_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ImmuService_DescribeTable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ImmuService_DescribeTable_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ImmuService_DescribeTable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -2589,6 +2881,14 @@ var ( pattern_ImmuService_ChangePermission_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "changepermission"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ImmuService_SetActiveUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "setactiveUser"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ImmuService_SQLExec_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"db", "sqlexec"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ImmuService_SQLQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"db", "sqlquery"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ImmuService_ListTables_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"db", "table", "list"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ImmuService_DescribeTable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"db", "tables"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -2653,4 +2953,12 @@ var ( forward_ImmuService_ChangePermission_0 = runtime.ForwardResponseMessage forward_ImmuService_SetActiveUser_0 = runtime.ForwardResponseMessage + + forward_ImmuService_SQLExec_0 = runtime.ForwardResponseMessage + + forward_ImmuService_SQLQuery_0 = runtime.ForwardResponseMessage + + forward_ImmuService_ListTables_0 = runtime.ForwardResponseMessage + + forward_ImmuService_DescribeTable_0 = runtime.ForwardResponseMessage ) diff --git a/pkg/api/schema/schema.swagger.json b/pkg/api/schema/schema.swagger.json index fe652edc65..02b8443e64 100644 --- a/pkg/api/schema/schema.swagger.json +++ b/pkg/api/schema/schema.swagger.json @@ -388,6 +388,71 @@ ] } }, + "/db/sqlexec": { + "post": { + "summary": "SQL", + "operationId": "ImmuService_SQLExec", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/schemaSQLExecResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/schemaSQLExecRequest" + } + } + ], + "tags": [ + "ImmuService" + ] + } + }, + "/db/sqlquery": { + "post": { + "operationId": "ImmuService_SQLQuery", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/schemaSQLQueryResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/schemaSQLQueryRequest" + } + } + ], + "tags": [ + "ImmuService" + ] + } + }, "/db/state": { "get": { "operationId": "ImmuService_CurrentState", @@ -411,6 +476,60 @@ "security": [] } }, + "/db/table/list": { + "get": { + "operationId": "ImmuService_ListTables", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/schemaSQLQueryResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "tags": [ + "ImmuService" + ] + } + }, + "/db/tables": { + "post": { + "operationId": "ImmuService_DescribeTable", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/schemaSQLQueryResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/schemaTable" + } + } + ], + "tags": [ + "ImmuService" + ] + } + }, "/db/tx": { "post": { "operationId": "ImmuService_TxScan", @@ -987,7 +1106,7 @@ "description": "Must be a valid serialized protocol buffer of the above specified type." } }, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "protobufNullValue": { "type": "string", @@ -1491,6 +1610,23 @@ } } }, + "schemaSQLExecRequest": { + "type": "object", + "properties": { + "sql": { + "type": "string" + }, + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/schemaNamedParam" + } + }, + "noWait": { + "type": "boolean" + } + } + }, "schemaSQLExecResult": { "type": "object", "properties": { @@ -1508,6 +1644,20 @@ } } }, + "schemaSQLQueryRequest": { + "type": "object", + "properties": { + "sql": { + "type": "string" + }, + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/schemaNamedParam" + } + } + } + }, "schemaSQLQueryResult": { "type": "object", "properties": { @@ -1621,6 +1771,14 @@ } } }, + "schemaTable": { + "type": "object", + "properties": { + "tableName": { + "type": "string" + } + } + }, "schemaTx": { "type": "object", "properties": { diff --git a/pkg/server/options.go b/pkg/server/options.go index b9e8f536c0..d18809cb4b 100644 --- a/pkg/server/options.go +++ b/pkg/server/options.go @@ -48,6 +48,8 @@ type Options struct { NoHistograms bool Detached bool MetricsServer bool + WebServer bool + WebServerPort int DevMode bool AdminPassword string `json:"-"` systemAdminDbName string @@ -69,6 +71,7 @@ func DefaultOptions() *Options { Address: "0.0.0.0", Port: 3322, MetricsPort: 9497, + WebServerPort: 8080, Config: "configs/immudb.toml", Pidfile: "", Logfile: "", @@ -78,6 +81,7 @@ func DefaultOptions() *Options { NoHistograms: false, Detached: false, MetricsServer: true, + WebServer: true, DevMode: false, AdminPassword: auth.SysAdminPassword, systemAdminDbName: SystemdbName, @@ -195,6 +199,11 @@ func (o *Options) MetricsBind() string { return o.Address + ":" + strconv.Itoa(o.MetricsPort) } +// WebBind return bind address for the Web API/console +func (o *Options) WebBind() string { + return o.Address + ":" + strconv.Itoa(o.WebServerPort) +} + // String print options func (o *Options) String() string { rightPad := func(k string, v interface{}) string { @@ -236,6 +245,20 @@ func (o *Options) WithMetricsServer(metricsServer bool) *Options { return o } +// WithWebServer ... +func (o *Options) WithWebServer(webServer bool) *Options { + o.WebServer = webServer + return o +} + +// WithWebServerPort ... +func (o *Options) WithWebServerPort(port int) *Options { + if port > 0 { + o.WebServerPort = port + } + return o +} + // WithDevMode ... func (o *Options) WithDevMode(devMode bool) *Options { o.DevMode = devMode diff --git a/pkg/server/options_test.go b/pkg/server/options_test.go index 85d1c9f506..0a3c8660a0 100644 --- a/pkg/server/options_test.go +++ b/pkg/server/options_test.go @@ -17,11 +17,14 @@ limitations under the License. package server import ( + "crypto/tls" "testing" + "github.com/codenotary/immudb/embedded/store" "github.com/codenotary/immudb/pkg/stream" - "github.com/codenotary/immudb/pkg/auth" + + "github.com/stretchr/testify/assert" ) func TestOptions(t *testing.T) { @@ -42,19 +45,30 @@ func TestOptions(t *testing.T) { op.Config != "configs/immudb.toml" || op.Pidfile != "" || op.StreamChunkSize != stream.DefaultChunkSize || - op.Logfile != "" { + op.Logfile != "" || + op.WebServer != true || + op.WebServerPort != 8080 || + op.WebBind() != "0.0.0.0:8080" || + op.MetricsBind() != "0.0.0.0:9497" { t.Errorf("database default options mismatch") } } func TestSetOptions(t *testing.T) { + storeOptions := store.DefaultOptions() + tlsConfig := &tls.Config{Certificates: []tls.Certificate{}} op := DefaultOptions().WithDir("immudb_dir").WithNetwork("udp"). WithAddress("localhost").WithPort(2048). WithPidfile("immu.pid").WithAuth(false). WithMaxRecvMsgSize(4096). WithDetached(true).WithNoHistograms(true).WithMetricsServer(false). WithDevMode(true).WithLogfile("logfile").WithAdminPassword("admin"). - WithStreamChunkSize(4096) + WithStreamChunkSize(4096). + WithWebServerPort(8081). + WithTokenExpiryTime(52). + WithWebServer(false). + WithStoreOptions(storeOptions). + WithTLS(tlsConfig) if op.GetAuth() != false || op.Dir != "immudb_dir" || @@ -72,7 +86,50 @@ func TestSetOptions(t *testing.T) { op.Logfile != "logfile" || op.AdminPassword != "admin" || op.StreamChunkSize != 4096 || - op.Bind() != "localhost:2048" { + op.WebServerPort != 8081 || + op.Bind() != "localhost:2048" || + op.WebBind() != "localhost:8081" || + op.WebServer != false || + op.StoreOptions != storeOptions || + op.TLSConfig != tlsConfig || + op.TokenExpiryTimeMin != 52 { t.Errorf("database default options mismatch") } } + +func TestOptionsMaintenance(t *testing.T) { + op := DefaultOptions(). + WithAuth(true). + WithMaintenance(true) + + if op.GetAuth() != false { + t.Errorf("Auth should be disabled in maintenance mode") + } +} + +func TestOptionsString(t *testing.T) { + expected := `================ Config ================ +Data dir : ./data +Address : 0.0.0.0:3322 +Metrics address : 0.0.0.0:9497/metrics +Config file : configs/immudb.toml +PID file : immu.pid +Log file : immu.log +Max recv msg size: 33554432 +Auth enabled : true +Dev mode : false +Default database : defaultdb +Maintenance mode : false +Synced mode : true +---------------------------------------- +Superadmin default credentials + Username : immudb + Password : immudb +========================================` + + op := DefaultOptions(). + WithPidfile("immu.pid"). + WithLogfile("immu.log") + + assert.Equal(t, expected, op.String()) +} diff --git a/pkg/server/server.go b/pkg/server/server.go index 99aa8917d2..6fe1313a35 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -187,7 +187,7 @@ func (s *ImmuServer) Initialize() error { s.GrpcServer = grpc.NewServer(grpcSrvOpts...) schema.RegisterImmuServiceServer(s.GrpcServer, s) grpc_prometheus.Register(s.GrpcServer) - + return err } @@ -220,6 +220,17 @@ func (s *ImmuServer) Start() (err error) { } }() + if s.Options.WebServer { + if err := s.setUpWebServer(); err != nil { + return err + } + defer func() { + if err := s.webServer.Close(); err != nil { + s.Logger.Errorf("Failed to shutdown web API/console server: %s", err) + } + }() + } + s.mux.Unlock() <-s.quit @@ -254,6 +265,20 @@ func (s *ImmuServer) setUpMetricsServer() error { return nil } +func (s *ImmuServer) setUpWebServer() error { + server, err := StartWebServer( + s.Options.WebBind(), + s.Options.TLSConfig, + s, + s.Logger, + ) + if err != nil { + return err + } + s.webServer = server + return nil +} + func (s *ImmuServer) printUsageCallToAction() { time.Sleep(200 * time.Millisecond) immuadminCLI := helper.Blue + "immuadmin" + helper.Green diff --git a/pkg/server/types.go b/pkg/server/types.go index 0129ba2f74..f6fcf81af7 100644 --- a/pkg/server/types.go +++ b/pkg/server/types.go @@ -64,10 +64,11 @@ type ImmuServer struct { userdata *usernameToUserdataMap multidbmode bool //Cc CorruptionChecker - sysDb database.DB - metricsServer *http.Server - mux sync.Mutex - StateSigner StateSigner + sysDb database.DB + metricsServer *http.Server + webServer *http.Server + mux sync.Mutex + StateSigner StateSigner StreamServiceFactory stream.ServiceFactory } diff --git a/pkg/server/webserver.go b/pkg/server/webserver.go new file mode 100644 index 0000000000..860ebb68e9 --- /dev/null +++ b/pkg/server/webserver.go @@ -0,0 +1,49 @@ +package server + +import ( + "context" + "crypto/tls" + "github.com/codenotary/immudb/pkg/api/schema" + "github.com/codenotary/immudb/pkg/logger" + "github.com/codenotary/immudb/webconsole" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "net/http" +) + +func StartWebServer(addr string, tlsConfig *tls.Config, s schema.ImmuServiceServer, l logger.Logger) (*http.Server, error) { + proxyMux := runtime.NewServeMux() + err := schema.RegisterImmuServiceHandlerServer(context.Background(), proxyMux, s) + if err != nil { + return nil, err + } + + webMux := http.NewServeMux() + webMux.Handle("/api/", http.StripPrefix("/api", proxyMux)) + + err = webconsole.SetupWebconsole(webMux, l, addr) + if err != nil { + return nil, err + } + + httpServer := &http.Server{Addr: addr, Handler: webMux} + httpServer.TLSConfig = tlsConfig + + go func() { + var err error + if tlsConfig != nil { + l.Infof("Web API server enabled on %s/api (https)", addr) + err = httpServer.ListenAndServeTLS("", "") + } else { + l.Infof("Web API server enabled on %s/api (http)", addr) + err = httpServer.ListenAndServe() + } + + if err == http.ErrServerClosed { + l.Debugf("Web API/console server closed") + } else { + l.Errorf("Web API/console error: %s", err) + } + }() + + return httpServer, nil +} diff --git a/pkg/server/webserver_test.go b/pkg/server/webserver_test.go new file mode 100644 index 0000000000..c987808050 --- /dev/null +++ b/pkg/server/webserver_test.go @@ -0,0 +1,62 @@ +/* +Copyright 2021 CodeNotary, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package server + +import ( + "crypto/tls" + "net/http" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestStartWebServerHTTP(t *testing.T) { + options := DefaultOptions() + server := DefaultServer().WithOptions(options).(*ImmuServer) + + webServer, err := StartWebServer( + "0.0.0.0:8080", + nil, + server, + &mockLogger{}) + defer webServer.Close() + + assert.IsType(t, &http.Server{}, webServer) + assert.Nil(t, webServer.TLSConfig) + assert.Nil(t, err) +} + +func TestStartWebServerHTTPS(t *testing.T) { + options := DefaultOptions() + tlsConfig := &tls.Config{ + Certificates: []tls.Certificate{}, + ClientAuth: tls.VerifyClientCertIfGiven, + } + + server := DefaultServer().WithOptions(options).(*ImmuServer) + + webServer, err := StartWebServer( + "0.0.0.0:8080", + tlsConfig, + server, + &mockLogger{}) + defer webServer.Close() + + assert.IsType(t, &http.Server{}, webServer) + assert.NotNil(t, webServer.TLSConfig) + assert.Nil(t, err) +} diff --git a/tools.go b/tools.go index c4f74fc932..4d7afce942 100644 --- a/tools.go +++ b/tools.go @@ -9,5 +9,5 @@ import ( _ "github.com/golang/protobuf/proto" _ "github.com/golang/protobuf/protoc-gen-go" _ "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" - + _ "github.com/rakyll/statik" ) diff --git a/webconsole/webconsole.go b/webconsole/webconsole.go new file mode 100644 index 0000000000..420cdd0b85 --- /dev/null +++ b/webconsole/webconsole.go @@ -0,0 +1,22 @@ +// +build webconsole +//go:generate go run github.com/rakyll/statik -f -src=./dist + +package webconsole + +import ( + "github.com/codenotary/immudb/pkg/logger" + "net/http" + // embedded static files + _ "github.com/codenotary/immudb/webconsole/statik" + "github.com/rakyll/statik/fs" +) + +func SetupWebconsole(mux *http.ServeMux, l logger.Logger, addr string) error { + statikFS, err := fs.New() + if err != nil { + return err + } + l.Infof("Webconsole enabled: %s", addr) + mux.Handle("/", http.FileServer(statikFS)) + return nil +} diff --git a/webconsole/webconsole_default.go b/webconsole/webconsole_default.go new file mode 100644 index 0000000000..c31f521c48 --- /dev/null +++ b/webconsole/webconsole_default.go @@ -0,0 +1,13 @@ +// +build !webconsole + +package webconsole + +import ( + "github.com/codenotary/immudb/pkg/logger" + "net/http" +) + +func SetupWebconsole(_ *http.ServeMux, _ logger.Logger, _ string) error { + // no op + return nil +}