diff --git a/.github/workflows/build-tests.yml b/.github/workflows/build-tests.yml index 5a1ea3e..d053769 100644 --- a/.github/workflows/build-tests.yml +++ b/.github/workflows/build-tests.yml @@ -41,7 +41,7 @@ jobs: name: Protoc Tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install protoc run: | @@ -51,7 +51,7 @@ jobs: chmod +x $HOME/.local/bin/protoc rm -f $PROTOC_ZIP.zip - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install pipenv diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 2200536..bfdf97c 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -15,13 +15,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Go 1.18 - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: 1.18 - name: Checkout code into go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Lint with golangci-lint - uses: golangci/golangci-lint-action@v3.6.0 + uses: golangci/golangci-lint-action@v3.7.0 with: args: --timeout 5m skip-cache: true diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 30108ef..b907bb1 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -10,8 +10,8 @@ jobs: name: Spellcheck runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - uses: rojopolis/spellcheck-github-actions@0.33.1 + - uses: actions/checkout@v4 + - uses: rojopolis/spellcheck-github-actions@0.35.0 name: Spellcheck with: config_path: .github/configs/spellcheck.yml @@ -19,10 +19,10 @@ jobs: name: Commitlint runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: "14" @@ -39,7 +39,7 @@ jobs: name: LinkCheck runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: gaurav-nelson/github-action-markdown-link-check@v1 with: use-quiet-mode: "yes" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f476b1..9fea564 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/go.mod b/go.mod index 29b4975..e9b0063 100644 --- a/go.mod +++ b/go.mod @@ -14,12 +14,12 @@ replace ( require ( github.com/sirupsen/logrus v1.9.3 github.com/vhive-serverless/vSwarm/utils/tracing/go v0.0.0-20230802102142-dbfda39fc27c - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.60.0 google.golang.org/protobuf v1.31.0 ) require ( - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/containerd/containerd v1.7.3 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -31,9 +31,8 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/sdk v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/net v0.13.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect ) diff --git a/go.sum b/go.sum index 9c7775d..99d8d2d 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,14 @@ -cloud.google.com/go v0.110.2 h1:sdFPBr6xG9/wkBbfhmUz/JmZC7X6LavQgcrVINrKiVA= +cloud.google.com/go v0.99.0 h1:y/cM2iqGgGi5D5DQZl6D9STN/3dR/Vx5Mp8s752oJTY= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/containerd/containerd v1.7.3 h1:cKwYKkP1eTj54bP3wCdXXBymmKRQMrWjkLSWZZJDa8o= github.com/containerd/containerd v1.7.3/go.mod h1:32FOM4/O0RkNg7AjQj3hDzN9cUGtu+HMvaKUNiqCZB8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -42,21 +42,20 @@ go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvx go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= -golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= -golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf h1:guOdSPaeFgN+jEJwTo1dQ71hdBm+yKSCCKuTRkJzcVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/grpcclient/aes_client.go b/grpcclient/aes_client.go index 4a263f1..0f12695 100644 --- a/grpcclient/aes_client.go +++ b/grpcclient/aes_client.go @@ -4,7 +4,6 @@ import ( "context" "math/rand" - log "github.com/sirupsen/logrus" pb "github.com/vhive-serverless/vSwarm-proto/proto/aes" ) @@ -49,16 +48,19 @@ type AesClient struct { client pb.AesClient } -func (c *AesClient) Init(ctx context.Context, ip, port string) { - log.Printf("Connect to: %s:%s\n", ip, port) - c.Connect(ctx, ip, port) +func (c *AesClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewAesClient(c.conn) + return nil } -func (c *AesClient) Request(ctx context.Context, req Input) string { +func (c *AesClient) Request(ctx context.Context, req Input) (string, error) { r, err := c.client.ShowEncryption(ctx, &pb.PlainTextMessage{PlaintextMessage: req.Value}) if err != nil { - log.Fatalf("could not greet: %v", err) + return "", err } - return r.GetEncryptionInfo() + return r.GetEncryptionInfo(), nil } diff --git a/grpcclient/auth_client.go b/grpcclient/auth_client.go index eb97bea..8e35b36 100644 --- a/grpcclient/auth_client.go +++ b/grpcclient/auth_client.go @@ -4,7 +4,6 @@ import ( "context" "math/rand" - log "github.com/sirupsen/logrus" pb "github.com/vhive-serverless/vSwarm-proto/proto/auth" ) @@ -38,16 +37,20 @@ type AuthClient struct { client pb.GreeterClient } -func (c *AuthClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *AuthClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewGreeterClient(c.conn) + return nil } -func (c *AuthClient) Request(ctx context.Context, req Input) string { +func (c *AuthClient) Request(ctx context.Context, req Input) (string, error) { var authMessage = req.Value r, err := c.client.SayHello(ctx, &pb.HelloRequest{Name: authMessage}) if err != nil { - log.Fatalf("could not greet: %v", err) + return "", err } - return r.GetMessage() + return r.GetMessage(), nil } diff --git a/grpcclient/fibonacci_client.go b/grpcclient/fibonacci_client.go index 37c0058..c0775b0 100644 --- a/grpcclient/fibonacci_client.go +++ b/grpcclient/fibonacci_client.go @@ -6,7 +6,6 @@ import ( "math/rand" pb "github.com/vhive-serverless/vSwarm-proto/proto/fibonacci" - log "github.com/sirupsen/logrus" ) type FibonacciGenerator struct { @@ -37,16 +36,20 @@ type FibonacciClient struct { client pb.GreeterClient } -func (c *FibonacciClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *FibonacciClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewGreeterClient(c.conn) + return nil } -func (c *FibonacciClient) Request(ctx context.Context, req Input) string { +func (c *FibonacciClient) Request(ctx context.Context, req Input) (string, error) { var fibonacciMessage = req.Value r, err := c.client.SayHello(ctx, &pb.HelloRequest{Name: fibonacciMessage}) if err != nil { - log.Fatalf("could not greet: %v", err) + return "", err } - return r.GetMessage() + return r.GetMessage(), nil } diff --git a/grpcclient/gaminganywhere_client.go b/grpcclient/gaminganywhere_client.go new file mode 100644 index 0000000..c1ce3d1 --- /dev/null +++ b/grpcclient/gaminganywhere_client.go @@ -0,0 +1,52 @@ +package grpcclient + +import ( + "context" + "fmt" + "math/rand" + + pb "github.com/vhive-serverless/vSwarm-proto/proto/helloworld" + log "github.com/sirupsen/logrus" +) + +type GamingAnywhereGenerator struct { + GeneratorBase +} + +func (g *GamingAnywhereGenerator) Next() Input { + var pkt = g.defaultInput + switch g.GeneratorBase.generator { + case Unique: + pkt.Value = "A unique message" + case Linear: + // g.count = g.count + 1 + // pkt.Value = fmt.Sprintf("%d", g.count) + pkt.Value = "A linear message" + case Random: + pkt.Value = "A random message" + } + return pkt +} + +func (c *GamingAnywhereClient) GetGenerator() Generator { + return new(GamingAnywhereGenerator) +} + +type GamingAnywhereClient struct { + ClientBase + client pb.GreeterClient +} + +func (c *GamingAnywhereClient) Init(ctx context.Context, ip, port string) { + c.Connect(ctx, ip, port) + c.client = pb.NewGreeterClient(c.conn) +} + +func (c *GamingAnywhereClient) Request(ctx context.Context, req Input) string { + var message = req.Value + r, err := c.client.SayHello(ctx, &pb.HelloRequest{Name: message}) + if err != nil { + log.Fatalf("could not greet: %v", err) + } + return r.GetMessage() +} diff --git a/grpcclient/getclient.go b/grpcclient/getclient.go index 66056aa..48c026c 100644 --- a/grpcclient/getclient.go +++ b/grpcclient/getclient.go @@ -12,6 +12,8 @@ func FindServiceName(functionName string) string { return "auth" case "fibonacci-go", "fibonacci-python", "fibonacci-nodejs", "fibonacci-cpp": return "fibonacci" + case "gptj-python": + return "gptj" default: return functionName } @@ -33,6 +35,9 @@ func FindGrpcClient(service_name string) GrpcClient { case "fibonacci": log.Debug("Found Fibonacci client") return new(FibonacciClient) + case "gptj": + log.Debug("Found gptj client") + return new(GptJClient) // Hotel reservation --- case "Geo", "geo": diff --git a/grpcclient/gptj_client.go b/grpcclient/gptj_client.go new file mode 100644 index 0000000..01ed41e --- /dev/null +++ b/grpcclient/gptj_client.go @@ -0,0 +1,51 @@ +package grpcclient + +import ( + "context" + log "github.com/sirupsen/logrus" + pb "github.com/vhive-serverless/vSwarm-proto/proto/gptj" +) + +type GptJGenerator struct { + GeneratorBase +} + +func (g *GptJGenerator) Next() Input { + var pkt = g.defaultInput + switch g.GeneratorBase.generator { + case Unique: + pkt.Value = "false" + case Linear: + pkt.Value = "false" + case Random: + pkt.Value = "true" + } + return pkt +} + +type GptJClient struct { + ClientBase + client pb.GptJBenchmarkClient +} + +func (c *GptJClient) GetGenerator() Generator { + return new(GptJGenerator) +} + +func (c *GptJClient) Init(ctx context.Context, ip, port string) error { + log.Printf("Connect to: %s:%s\n", ip, port) + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } + c.client = pb.NewGptJBenchmarkClient(c.conn) + return nil +} + +func (c *GptJClient) Request(ctx context.Context, req Input) (string, error) { + r, err := c.client.GetBenchmark(ctx, &pb.GptJBenchmarkRequest{Regenerate: req.Value}) + if err != nil { + return "", err + } + return r.GetLatencyInfo(), nil +} diff --git a/grpcclient/grpcclient.go b/grpcclient/grpcclient.go index 65a00ee..0998396 100644 --- a/grpcclient/grpcclient.go +++ b/grpcclient/grpcclient.go @@ -77,8 +77,8 @@ func (s *GeneratorBase) Decrement() int { // ------ gRPC Client interface ------ // Every client must implement this interface type GrpcClient interface { - Init(ctx context.Context, ip, port string) - Request(ctx context.Context, req Input) string + Init(ctx context.Context, ip, port string) error + Request(ctx context.Context, req Input) (string, error) Close() GetGenerator() Generator } @@ -90,12 +90,12 @@ type ClientBase struct { conn *grpc.ClientConn } -func (c *ClientBase) Connect(ctx context.Context, ip, port string) { +func (c *ClientBase) Connect(ctx context.Context, ip, port string) error { c.ip = ip c.port = port // Connect to the given address address := fmt.Sprintf("%s:%s", c.ip, c.port) - log.Debug("Connect to ", address) + log.Println("Connect to ", address) var conn *grpc.ClientConn var err error if tracing.IsTracingEnabled() { @@ -110,10 +110,11 @@ func (c *ClientBase) Connect(ctx context.Context, ip, port string) { log.Fields{ "event": "Connecting to benchmark server", "key": err, - }).Fatal("Failed to connect.") + }) + return err } c.conn = conn - + return nil } func (c *ClientBase) Close() { diff --git a/grpcclient/helloworld_client.go b/grpcclient/helloworld_client.go index 9ef1317..a81ff88 100644 --- a/grpcclient/helloworld_client.go +++ b/grpcclient/helloworld_client.go @@ -4,7 +4,6 @@ import ( "context" pb "github.com/vhive-serverless/vSwarm-proto/proto/helloworld" - log "github.com/sirupsen/logrus" ) // type HelloWorldGenerator struct { @@ -58,15 +57,19 @@ type HelloWorldClient struct { client pb.GreeterClient } -func (c *HelloWorldClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HelloWorldClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewGreeterClient(c.conn) + return nil } -func (c *HelloWorldClient) Request(ctx context.Context, req Input) string { +func (c *HelloWorldClient) Request(ctx context.Context, req Input) (string, error) { r, err := c.client.SayHello(ctx, &pb.HelloRequest{Name: req.Value}) if err != nil { - log.Fatalf("could not greet: %v", err) + return "", err } - return r.GetMessage() + return r.GetMessage(), nil } diff --git a/grpcclient/hipstershop_clients.go b/grpcclient/hipstershop_clients.go index 2a5ed0d..d00deea 100644 --- a/grpcclient/hipstershop_clients.go +++ b/grpcclient/hipstershop_clients.go @@ -5,8 +5,8 @@ import ( "fmt" "strconv" - pb "github.com/vhive-serverless/vSwarm-proto/proto/hipstershop" log "github.com/sirupsen/logrus" + pb "github.com/vhive-serverless/vSwarm-proto/proto/hipstershop" ) var ( @@ -63,20 +63,22 @@ var ( defProductId2 = "LS4PSXUNUM" ) -// // ------- Ad Service -------- -// type ShopAdServiceClient struct { ClientBase client pb.AdServiceClient } -func (c *ShopAdServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopAdServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewAdServiceClient(c.conn) + return nil } -func (c *ShopAdServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopAdServiceClient) Request(ctx context.Context, req Input) (string, error) { payload := req.Value // Create a default forward request @@ -86,12 +88,12 @@ func (c *ShopAdServiceClient) Request(ctx context.Context, req Input) string { fw_res, err := c.client.GetAds(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Ad service: %v", err) + return "", err } msg := fmt.Sprintf("%+v", fw_res) // log.Println(msg) - return msg + return msg, nil } type ShopAdServiceGenerator struct { @@ -106,20 +108,22 @@ func (c *ShopAdServiceClient) GetGenerator() Generator { return new(ShopAdServiceGenerator) } -// // ------- Cart Service -------- -// type ShopCartServiceClient struct { ClientBase client pb.CartServiceClient } -func (c *ShopCartServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopCartServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewCartServiceClient(c.conn) + return nil } -func (c *ShopCartServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopCartServiceClient) Request(ctx context.Context, req Input) (string, error) { fw_method := req.Method payload := req.Value @@ -158,12 +162,12 @@ func (c *ShopCartServiceClient) Request(ctx context.Context, req Input) string { } if err != nil { - log.Fatalf("Fail to invoke Cart service: %v", err) + return "", err } msg = fmt.Sprintf("method: %s, %s", fw_method, msg) // log.Println(msg) - return msg + return msg, nil } type ShopCartServiceGenerator struct { @@ -178,20 +182,22 @@ func (c *ShopCartServiceClient) GetGenerator() Generator { return new(ShopCartServiceGenerator) } -// // ------- Checkout Service -------- -// type ShopCheckoutServiceClient struct { ClientBase client pb.CheckoutServiceClient } -func (c *ShopCheckoutServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopCheckoutServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewCheckoutServiceClient(c.conn) + return nil } -func (c *ShopCheckoutServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopCheckoutServiceClient) Request(ctx context.Context, req Input) (string, error) { // Pass on to the real service function payload := req.Value @@ -207,12 +213,12 @@ func (c *ShopCheckoutServiceClient) Request(ctx context.Context, req Input) stri fw_res, err := c.client.PlaceOrder(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Checkout service: %v", err) + return "", err } msg := fmt.Sprintf("%+v", fw_res) // log.Println(msg) - return msg + return msg, nil } type ShopCheckoutServiceGenerator struct { @@ -227,20 +233,22 @@ func (c *ShopCheckoutServiceClient) GetGenerator() Generator { return new(ShopCheckoutServiceGenerator) } -// // ------- Currency Service -------- -// type ShopCurrencyServiceClient struct { ClientBase client pb.CurrencyServiceClient } -func (c *ShopCurrencyServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopCurrencyServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewCurrencyServiceClient(c.conn) + return nil } -func (c *ShopCurrencyServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopCurrencyServiceClient) Request(ctx context.Context, req Input) (string, error) { fw_method, payload := req.Method, req.Value // Pass on to the real service function @@ -271,12 +279,12 @@ func (c *ShopCurrencyServiceClient) Request(ctx context.Context, req Input) stri log.Fatalf("Failed to understand requested method: %s", fw_method) } if err != nil { - log.Fatalf("Fail to invoke Currency service: %v", err) + return "", err } msg = fmt.Sprintf("method: %s, %s", fw_method, msg) // log.Println(msg) - return msg + return msg, nil } type ShopCurrencyServiceGenerator struct { @@ -291,20 +299,22 @@ func (c *ShopCurrencyServiceClient) GetGenerator() Generator { return new(ShopCurrencyServiceGenerator) } -// // ------- Email Service -------- -// type ShopEmailServiceClient struct { ClientBase client pb.EmailServiceClient } -func (c *ShopEmailServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopEmailServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewEmailServiceClient(c.conn) + return nil } -func (c *ShopEmailServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopEmailServiceClient) Request(ctx context.Context, req Input) (string, error) { // Pass on to the real service function // _, payload := getMethodPayload(req) @@ -317,12 +327,11 @@ func (c *ShopEmailServiceClient) Request(ctx context.Context, req Input) string fw_res, err := c.client.SendOrderConfirmation(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Email service: %v", err) + return "", err } - msg := fmt.Sprintf("%+v", fw_res) // log.Println(msg) - return msg + return msg, nil } @@ -338,20 +347,22 @@ func (c *ShopEmailServiceClient) GetGenerator() Generator { return new(ShopEmailServiceGenerator) } -// // ------- Payment Service -------- -// type ShopPaymentServiceClient struct { ClientBase client pb.PaymentServiceClient } -func (c *ShopPaymentServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopPaymentServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewPaymentServiceClient(c.conn) + return nil } -func (c *ShopPaymentServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopPaymentServiceClient) Request(ctx context.Context, req Input) (string, error) { payload := req.Value // Create a default forward request @@ -366,12 +377,12 @@ func (c *ShopPaymentServiceClient) Request(ctx context.Context, req Input) strin fw_res, err := c.client.Charge(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Payment service: %v", err) + return "", err } msg := fmt.Sprintf("%+v", fw_res) // log.Println(msg) - return msg + return msg, nil } type ShopPaymentServiceGenerator struct { @@ -386,20 +397,22 @@ func (c *ShopPaymentServiceClient) GetGenerator() Generator { return new(ShopPaymentServiceGenerator) } -// // ------- ProductCatalog Service -------- -// type ShopProductCatalogServiceClient struct { ClientBase client pb.ProductCatalogServiceClient } -func (c *ShopProductCatalogServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopProductCatalogServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewProductCatalogServiceClient(c.conn) + return nil } -func (c *ShopProductCatalogServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopProductCatalogServiceClient) Request(ctx context.Context, req Input) (string, error) { fw_method := req.Method payload := req.Value @@ -435,12 +448,12 @@ func (c *ShopProductCatalogServiceClient) Request(ctx context.Context, req Input log.Fatalf("Failed to understand requested method: %s", fw_method) } if err != nil { - log.Fatalf("Fail to invoke ProductCatalog service: %v", err) + return "", err } msg = fmt.Sprintf("method: %s, %s", fw_method, msg) // log.Println(msg) - return msg + return msg, nil } type ShopProductCatalogServiceGenerator struct { @@ -455,20 +468,22 @@ func (c *ShopProductCatalogServiceClient) GetGenerator() Generator { return new(ShopProductCatalogServiceGenerator) } -// // ------- Recommendation Service -------- -// type ShopRecommendationServiceClient struct { ClientBase client pb.RecommendationServiceClient } -func (c *ShopRecommendationServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopRecommendationServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewRecommendationServiceClient(c.conn) + return nil } -func (c *ShopRecommendationServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopRecommendationServiceClient) Request(ctx context.Context, req Input) (string, error) { payload := req.Value // Create a default forward request @@ -479,11 +494,11 @@ func (c *ShopRecommendationServiceClient) Request(ctx context.Context, req Input fw_res, err := c.client.ListRecommendations(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Recommendation service: %v", err) + return "", err } msg := fmt.Sprintf("%+v", fw_res) // log.Println(msg) - return msg + return msg, nil } type ShopRecommendationServiceGenerator struct { @@ -498,20 +513,22 @@ func (c *ShopRecommendationServiceClient) GetGenerator() Generator { return new(ShopRecommendationServiceGenerator) } -// // ------- Shipping Service -------- -// type ShopShippingServiceClient struct { ClientBase client pb.ShippingServiceClient } -func (c *ShopShippingServiceClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *ShopShippingServiceClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = pb.NewShippingServiceClient(c.conn) + return nil } -func (c *ShopShippingServiceClient) Request(ctx context.Context, req Input) string { +func (c *ShopShippingServiceClient) Request(ctx context.Context, req Input) (string, error) { fw_method := req.Method @@ -542,12 +559,12 @@ func (c *ShopShippingServiceClient) Request(ctx context.Context, req Input) stri log.Fatalf("Failed to understand requested method: %s", fw_method) } if err != nil { - log.Fatalf("Fail to invoke Shipping service: %v", err) + return "", err } msg = fmt.Sprintf("method: %s, %s", fw_method, msg) // log.Println(msg) - return msg + return msg, nil } type ShopShippingServiceGenerator struct { diff --git a/grpcclient/hotel_clients.go b/grpcclient/hotel_clients.go index 9bae0ef..09f04c2 100644 --- a/grpcclient/hotel_clients.go +++ b/grpcclient/hotel_clients.go @@ -18,7 +18,6 @@ import ( log "github.com/sirupsen/logrus" ) -// // Hotel reservation ----- // 1. Geo service type HotelGeoClient struct { @@ -26,12 +25,16 @@ type HotelGeoClient struct { client geo.GeoClient } -func (c *HotelGeoClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HotelGeoClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = geo.NewGeoClient(c.conn) + return nil } -func (c *HotelGeoClient) Request(ctx context.Context, req Input) string { +func (c *HotelGeoClient) Request(ctx context.Context, req Input) (string, error) { // Create a default forward request coordinates := strings.Split(req.Value, ",") @@ -45,12 +48,12 @@ func (c *HotelGeoClient) Request(ctx context.Context, req Input) string { fw_res, err := c.client.Nearby(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Geo service: %v", err) + return "Fail to invoke Geo service", err } msg := fmt.Sprintf("req: { Lat:%f Lon:%f} resp: %+v", fw_req.Lon, fw_req.Lat, fw_res) // log.Println(msg) - return msg + return msg, err } type HotelGeoGenerator struct { @@ -87,12 +90,16 @@ type HotelProfileClient struct { client profile.ProfileClient } -func (c *HotelProfileClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HotelProfileClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = profile.NewProfileClient(c.conn) + return nil } -func (c *HotelProfileClient) Request(ctx context.Context, req Input) string { +func (c *HotelProfileClient) Request(ctx context.Context, req Input) (string, error) { payload := req.Value ids := strings.Split(payload, ",") // Create a forward request @@ -103,12 +110,12 @@ func (c *HotelProfileClient) Request(ctx context.Context, req Input) string { fw_res, err := c.client.GetProfiles(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Profile service: %v", err) + return "", err } msg := fmt.Sprintf("req: {HotelIds: %+v, Locale: \"\"} resp: %+v", ids, fw_res) // log.Println(msg) - return msg + return msg, nil } type HotelProfileGenerator struct { @@ -150,12 +157,16 @@ type HotelRateClient struct { client rate.RateClient } -func (c *HotelRateClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HotelRateClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = rate.NewRateClient(c.conn) + return nil } -func (c *HotelRateClient) Request(ctx context.Context, req Input) string { +func (c *HotelRateClient) Request(ctx context.Context, req Input) (string, error) { payload := req.Value ids := strings.Split(payload, ",") // Create a forward request @@ -166,12 +177,12 @@ func (c *HotelRateClient) Request(ctx context.Context, req Input) string { } fw_res, err := c.client.GetRates(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Rate service: %v", err) + return "", err } msg := fmt.Sprintf("req: {HotelIds: %+v, InDate: \"2015-04-09\", OutDate: \"2015-04-11\"}, resp: %+v", ids, fw_res) // log.Println(msg) - return msg + return msg, nil } type HotelRateGenerator struct { @@ -204,12 +215,16 @@ type HotelRecommendationClient struct { client recommendation.RecommendationClient } -func (c *HotelRecommendationClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HotelRecommendationClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = recommendation.NewRecommendationClient(c.conn) + return nil } -func (c *HotelRecommendationClient) Request(ctx context.Context, req Input) string { +func (c *HotelRecommendationClient) Request(ctx context.Context, req Input) (string, error) { // Create a default forward request coordinates := strings.Split(req.Value, ",") @@ -232,12 +247,12 @@ func (c *HotelRecommendationClient) Request(ctx context.Context, req Input) stri fw_res, err := c.client.GetRecommendations(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Recommendation service: %v", err) + return "", err } msg := fmt.Sprintf("req: {Require: \"dis\", Lat:%f Lon:%f}, resp: %+v", fw_req.Lon, fw_req.Lat, fw_res) // log.Println(msg) - return msg + return msg, nil } type HotelRecommendationGenerator struct { @@ -268,12 +283,16 @@ type HotelReservationClient struct { client reservation.ReservationClient } -func (c *HotelReservationClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HotelReservationClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = reservation.NewReservationClient(c.conn) + return nil } -func (c *HotelReservationClient) Request(ctx context.Context, req Input) string { +func (c *HotelReservationClient) Request(ctx context.Context, req Input) (string, error) { fw_method := req.Method payload := strings.Split(req.Value, ",") // Create a default forward request @@ -302,12 +321,12 @@ func (c *HotelReservationClient) Request(ctx context.Context, req Input) string log.Fatalf("Failed to understand requested method: %s", fw_method) } if err != nil { - log.Fatalf("Fail to invoke Reservation service: %v", err) + return "", err } msg := fmt.Sprintf("method: %s, req: {CustomerName: %s, HotelId: %v, InDate: \"2015-04-09\", OutDate: \"2015-04-11\", RoomNumber: 1,} resp: %+v", fw_method, fw_req.CustomerName, fw_req.HotelId, fw_res) // log.Println(msg) - return msg + return msg, nil } type HotelReservationGenerator struct { @@ -345,12 +364,16 @@ type HotelUserClient struct { client user.UserClient } -func (c *HotelUserClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HotelUserClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = user.NewUserClient(c.conn) + return nil } -func (c *HotelUserClient) Request(ctx context.Context, req Input) string { +func (c *HotelUserClient) Request(ctx context.Context, req Input) (string, error) { payload := strings.Split(req.Value, ",") // Create a forward request @@ -361,12 +384,12 @@ func (c *HotelUserClient) Request(ctx context.Context, req Input) string { fw_res, err := c.client.CheckUser(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke User service: %v", err) + return "", err } msg := fmt.Sprintf("req: {Username: %s, Password: %s} resp: Correct:%v", fw_req.Username, fw_req.Password, fw_res.Correct) // log.Println(msg) - return msg + return msg, nil } type HotelUserGenerator struct { @@ -404,12 +427,16 @@ type HotelSearchClient struct { client search.SearchClient } -func (c *HotelSearchClient) Init(ctx context.Context, ip, port string) { - c.Connect(ctx, ip, port) +func (c *HotelSearchClient) Init(ctx context.Context, ip, port string) error { + err := c.Connect(ctx, ip, port) + if err != nil { + return err + } c.client = search.NewSearchClient(c.conn) + return nil } -func (c *HotelSearchClient) Request(ctx context.Context, req Input) string { +func (c *HotelSearchClient) Request(ctx context.Context, req Input) (string, error) { // Create a forward request fw_req := search.NearbyRequest{ Lat: 37.7963, @@ -420,12 +447,12 @@ func (c *HotelSearchClient) Request(ctx context.Context, req Input) string { fw_res, err := c.client.Nearby(ctx, &fw_req) if err != nil { - log.Fatalf("Fail to invoke Search service: %v", err) + return "", err } msg := fmt.Sprintf("req: {Lat: 37.7963, Lon: -122.4015, InDate: \"2015-04-09\", OutDate: \"2015-04-11\"}, resp: %+v", fw_res) // log.Println(msg) - return msg + return msg, nil } type HotelSearchGenerator struct { diff --git a/proto/gptj/gptj.pb.go b/proto/gptj/gptj.pb.go new file mode 100644 index 0000000..aba6f22 --- /dev/null +++ b/proto/gptj/gptj.pb.go @@ -0,0 +1,216 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: gptj.proto + +package gptj + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GptJBenchmarkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Regenerate string `protobuf:"bytes,1,opt,name=regenerate,proto3" json:"regenerate,omitempty"` // Calling this will rerun the benchmark if true, else just read from benchmark results on txt file +} + +func (x *GptJBenchmarkRequest) Reset() { + *x = GptJBenchmarkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gptj_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GptJBenchmarkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GptJBenchmarkRequest) ProtoMessage() {} + +func (x *GptJBenchmarkRequest) ProtoReflect() protoreflect.Message { + mi := &file_gptj_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GptJBenchmarkRequest.ProtoReflect.Descriptor instead. +func (*GptJBenchmarkRequest) Descriptor() ([]byte, []int) { + return file_gptj_proto_rawDescGZIP(), []int{0} +} + +func (x *GptJBenchmarkRequest) GetRegenerate() string { + if x != nil { + return x.Regenerate + } + return "" +} + +type GptJBenchmarkReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LatencyInfo string `protobuf:"bytes,1,opt,name=latency_info,json=latencyInfo,proto3" json:"latency_info,omitempty"` +} + +func (x *GptJBenchmarkReply) Reset() { + *x = GptJBenchmarkReply{} + if protoimpl.UnsafeEnabled { + mi := &file_gptj_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GptJBenchmarkReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GptJBenchmarkReply) ProtoMessage() {} + +func (x *GptJBenchmarkReply) ProtoReflect() protoreflect.Message { + mi := &file_gptj_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GptJBenchmarkReply.ProtoReflect.Descriptor instead. +func (*GptJBenchmarkReply) Descriptor() ([]byte, []int) { + return file_gptj_proto_rawDescGZIP(), []int{1} +} + +func (x *GptJBenchmarkReply) GetLatencyInfo() string { + if x != nil { + return x.LatencyInfo + } + return "" +} + +var File_gptj_proto protoreflect.FileDescriptor + +var file_gptj_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x67, 0x70, 0x74, 0x6a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x70, + 0x74, 0x6a, 0x22, 0x36, 0x0a, 0x14, 0x47, 0x70, 0x74, 0x4a, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, + 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x22, 0x37, 0x0a, 0x12, 0x47, 0x70, + 0x74, 0x4a, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x49, + 0x6e, 0x66, 0x6f, 0x32, 0x57, 0x0a, 0x0d, 0x47, 0x70, 0x74, 0x4a, 0x42, 0x65, 0x6e, 0x63, 0x68, + 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x42, 0x65, 0x6e, 0x63, 0x68, + 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x1a, 0x2e, 0x67, 0x70, 0x74, 0x6a, 0x2e, 0x47, 0x70, 0x74, 0x4a, + 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x18, 0x2e, 0x67, 0x70, 0x74, 0x6a, 0x2e, 0x47, 0x70, 0x74, 0x4a, 0x42, 0x65, 0x6e, 0x63, + 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x35, 0x5a, 0x33, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x76, 0x68, 0x69, 0x76, 0x65, + 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x6c, 0x65, 0x73, 0x73, 0x2f, 0x76, 0x53, 0x77, 0x61, + 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x70, 0x74, 0x6a, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_gptj_proto_rawDescOnce sync.Once + file_gptj_proto_rawDescData = file_gptj_proto_rawDesc +) + +func file_gptj_proto_rawDescGZIP() []byte { + file_gptj_proto_rawDescOnce.Do(func() { + file_gptj_proto_rawDescData = protoimpl.X.CompressGZIP(file_gptj_proto_rawDescData) + }) + return file_gptj_proto_rawDescData +} + +var file_gptj_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_gptj_proto_goTypes = []interface{}{ + (*GptJBenchmarkRequest)(nil), // 0: gptj.GptJBenchmarkRequest + (*GptJBenchmarkReply)(nil), // 1: gptj.GptJBenchmarkReply +} +var file_gptj_proto_depIdxs = []int32{ + 0, // 0: gptj.GptJBenchmark.GetBenchmark:input_type -> gptj.GptJBenchmarkRequest + 1, // 1: gptj.GptJBenchmark.GetBenchmark:output_type -> gptj.GptJBenchmarkReply + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_gptj_proto_init() } +func file_gptj_proto_init() { + if File_gptj_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_gptj_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GptJBenchmarkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gptj_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GptJBenchmarkReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_gptj_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_gptj_proto_goTypes, + DependencyIndexes: file_gptj_proto_depIdxs, + MessageInfos: file_gptj_proto_msgTypes, + }.Build() + File_gptj_proto = out.File + file_gptj_proto_rawDesc = nil + file_gptj_proto_goTypes = nil + file_gptj_proto_depIdxs = nil +} diff --git a/proto/gptj/gptj.proto b/proto/gptj/gptj.proto new file mode 100644 index 0000000..287a9ae --- /dev/null +++ b/proto/gptj/gptj.proto @@ -0,0 +1,40 @@ +// MIT License + +// Copyright (c) 2021 EASE Lab + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +syntax = "proto3"; + +option go_package = "github.com/vhive-serverless/vSwarm-proto/proto/gptj"; + +package gptj; + +service GptJBenchmark { + rpc GetBenchmark (GptJBenchmarkRequest) returns (GptJBenchmarkReply) {} +} + +message GptJBenchmarkRequest { + string regenerate = 1; // Calling this will rerun the benchmark if true, else just read from benchmark results on txt file +} + +message GptJBenchmarkReply { + string latency_info = 1; +} \ No newline at end of file diff --git a/proto/gptj/gptj_grpc.pb.go b/proto/gptj/gptj_grpc.pb.go new file mode 100644 index 0000000..0c3b35c --- /dev/null +++ b/proto/gptj/gptj_grpc.pb.go @@ -0,0 +1,101 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package gptj + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// GptJBenchmarkClient is the client API for GptJBenchmark service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type GptJBenchmarkClient interface { + GetBenchmark(ctx context.Context, in *GptJBenchmarkRequest, opts ...grpc.CallOption) (*GptJBenchmarkReply, error) +} + +type gptJBenchmarkClient struct { + cc grpc.ClientConnInterface +} + +func NewGptJBenchmarkClient(cc grpc.ClientConnInterface) GptJBenchmarkClient { + return &gptJBenchmarkClient{cc} +} + +func (c *gptJBenchmarkClient) GetBenchmark(ctx context.Context, in *GptJBenchmarkRequest, opts ...grpc.CallOption) (*GptJBenchmarkReply, error) { + out := new(GptJBenchmarkReply) + err := c.cc.Invoke(ctx, "/gptj.GptJBenchmark/GetBenchmark", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// GptJBenchmarkServer is the server API for GptJBenchmark service. +// All implementations must embed UnimplementedGptJBenchmarkServer +// for forward compatibility +type GptJBenchmarkServer interface { + GetBenchmark(context.Context, *GptJBenchmarkRequest) (*GptJBenchmarkReply, error) + mustEmbedUnimplementedGptJBenchmarkServer() +} + +// UnimplementedGptJBenchmarkServer must be embedded to have forward compatible implementations. +type UnimplementedGptJBenchmarkServer struct { +} + +func (UnimplementedGptJBenchmarkServer) GetBenchmark(context.Context, *GptJBenchmarkRequest) (*GptJBenchmarkReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBenchmark not implemented") +} +func (UnimplementedGptJBenchmarkServer) mustEmbedUnimplementedGptJBenchmarkServer() {} + +// UnsafeGptJBenchmarkServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GptJBenchmarkServer will +// result in compilation errors. +type UnsafeGptJBenchmarkServer interface { + mustEmbedUnimplementedGptJBenchmarkServer() +} + +func RegisterGptJBenchmarkServer(s grpc.ServiceRegistrar, srv GptJBenchmarkServer) { + s.RegisterService(&GptJBenchmark_ServiceDesc, srv) +} + +func _GptJBenchmark_GetBenchmark_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GptJBenchmarkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GptJBenchmarkServer).GetBenchmark(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gptj.GptJBenchmark/GetBenchmark", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GptJBenchmarkServer).GetBenchmark(ctx, req.(*GptJBenchmarkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// GptJBenchmark_ServiceDesc is the grpc.ServiceDesc for GptJBenchmark service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var GptJBenchmark_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gptj.GptJBenchmark", + HandlerType: (*GptJBenchmarkServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetBenchmark", + Handler: _GptJBenchmark_GetBenchmark_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "gptj.proto", +} diff --git a/proto/gptj/gptj_pb2.py b/proto/gptj/gptj_pb2.py new file mode 100644 index 0000000..ded43b7 --- /dev/null +++ b/proto/gptj/gptj_pb2.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: gptj.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\ngptj.proto\x12\x04gptj\"*\n\x14GptJBenchmarkRequest\x12\x12\n\nregenerate\x18\x01 \x01(\t\"*\n\x12GptJBenchmarkReply\x12\x14\n\x0clatency_info\x18\x01 \x01(\t2W\n\rGptJBenchmark\x12\x46\n\x0cGetBenchmark\x12\x1a.gptj.GptJBenchmarkRequest\x1a\x18.gptj.GptJBenchmarkReply\"\x00\x42\x35Z3github.com/vhive-serverless/vSwarm-proto/proto/gptjb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'gptj_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'Z3github.com/vhive-serverless/vSwarm-proto/proto/gptj' + _globals['_GPTJBENCHMARKREQUEST']._serialized_start=20 + _globals['_GPTJBENCHMARKREQUEST']._serialized_end=62 + _globals['_GPTJBENCHMARKREPLY']._serialized_start=64 + _globals['_GPTJBENCHMARKREPLY']._serialized_end=106 + _globals['_GPTJBENCHMARK']._serialized_start=108 + _globals['_GPTJBENCHMARK']._serialized_end=195 +# @@protoc_insertion_point(module_scope) diff --git a/proto/gptj/gptj_pb2_grpc.py b/proto/gptj/gptj_pb2_grpc.py new file mode 100644 index 0000000..c31defe --- /dev/null +++ b/proto/gptj/gptj_pb2_grpc.py @@ -0,0 +1,66 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +import gptj_pb2 as gptj__pb2 + + +class GptJBenchmarkStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetBenchmark = channel.unary_unary( + '/gptj.GptJBenchmark/GetBenchmark', + request_serializer=gptj__pb2.GptJBenchmarkRequest.SerializeToString, + response_deserializer=gptj__pb2.GptJBenchmarkReply.FromString, + ) + + +class GptJBenchmarkServicer(object): + """Missing associated documentation comment in .proto file.""" + + def GetBenchmark(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_GptJBenchmarkServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GetBenchmark': grpc.unary_unary_rpc_method_handler( + servicer.GetBenchmark, + request_deserializer=gptj__pb2.GptJBenchmarkRequest.FromString, + response_serializer=gptj__pb2.GptJBenchmarkReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'gptj.GptJBenchmark', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class GptJBenchmark(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def GetBenchmark(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/gptj.GptJBenchmark/GetBenchmark', + gptj__pb2.GptJBenchmarkRequest.SerializeToString, + gptj__pb2.GptJBenchmarkReply.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/proto/helloworld/helloworld.pb.cc b/proto/helloworld/helloworld.pb.cc new file mode 100644 index 0000000..f9542fe --- /dev/null +++ b/proto/helloworld/helloworld.pb.cc @@ -0,0 +1,574 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: helloworld.proto + +#include "helloworld.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG + +namespace _pb = ::PROTOBUF_NAMESPACE_ID; +namespace _pbi = _pb::internal; + +namespace helloworld { +PROTOBUF_CONSTEXPR HelloRequest::HelloRequest( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.vhivemetadata_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct HelloRequestDefaultTypeInternal { + PROTOBUF_CONSTEXPR HelloRequestDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~HelloRequestDefaultTypeInternal() {} + union { + HelloRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HelloRequestDefaultTypeInternal _HelloRequest_default_instance_; +PROTOBUF_CONSTEXPR HelloReply::HelloReply( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.message_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct HelloReplyDefaultTypeInternal { + PROTOBUF_CONSTEXPR HelloReplyDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~HelloReplyDefaultTypeInternal() {} + union { + HelloReply _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HelloReplyDefaultTypeInternal _HelloReply_default_instance_; +} // namespace helloworld +static ::_pb::Metadata file_level_metadata_helloworld_2eproto[2]; +static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_helloworld_2eproto = nullptr; +static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_helloworld_2eproto = nullptr; + +const uint32_t TableStruct_helloworld_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::helloworld::HelloRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::helloworld::HelloRequest, _impl_.name_), + PROTOBUF_FIELD_OFFSET(::helloworld::HelloRequest, _impl_.vhivemetadata_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::helloworld::HelloReply, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::helloworld::HelloReply, _impl_.message_), +}; +static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::helloworld::HelloRequest)}, + { 8, -1, -1, sizeof(::helloworld::HelloReply)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::helloworld::_HelloRequest_default_instance_._instance, + &::helloworld::_HelloReply_default_instance_._instance, +}; + +const char descriptor_table_protodef_helloworld_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\020helloworld.proto\022\nhelloworld\"3\n\014HelloR" + "equest\022\014\n\004name\030\001 \001(\t\022\025\n\rvHiveMetadata\030\017 " + "\001(\014\"\035\n\nHelloReply\022\017\n\007message\030\001 \001(\t2I\n\007Gr" + "eeter\022>\n\010SayHello\022\030.helloworld.HelloRequ" + "est\032\026.helloworld.HelloReply\"\000B;Z9github." + "com/vhive-serverless/vSwarm-proto/proto/" + "helloworldb\006proto3" + ; +static ::_pbi::once_flag descriptor_table_helloworld_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_helloworld_2eproto = { + false, false, 258, descriptor_table_protodef_helloworld_2eproto, + "helloworld.proto", + &descriptor_table_helloworld_2eproto_once, nullptr, 0, 2, + schemas, file_default_instances, TableStruct_helloworld_2eproto::offsets, + file_level_metadata_helloworld_2eproto, file_level_enum_descriptors_helloworld_2eproto, + file_level_service_descriptors_helloworld_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_helloworld_2eproto_getter() { + return &descriptor_table_helloworld_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_helloworld_2eproto(&descriptor_table_helloworld_2eproto); +namespace helloworld { + +// =================================================================== + +class HelloRequest::_Internal { + public: +}; + +HelloRequest::HelloRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:helloworld.HelloRequest) +} +HelloRequest::HelloRequest(const HelloRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + HelloRequest* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.name_){} + , decltype(_impl_.vhivemetadata_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _impl_.name_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.name_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_name().empty()) { + _this->_impl_.name_.Set(from._internal_name(), + _this->GetArenaForAllocation()); + } + _impl_.vhivemetadata_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.vhivemetadata_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_vhivemetadata().empty()) { + _this->_impl_.vhivemetadata_.Set(from._internal_vhivemetadata(), + _this->GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:helloworld.HelloRequest) +} + +inline void HelloRequest::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.name_){} + , decltype(_impl_.vhivemetadata_){} + , /*decltype(_impl_._cached_size_)*/{} + }; + _impl_.name_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.name_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.vhivemetadata_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.vhivemetadata_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +HelloRequest::~HelloRequest() { + // @@protoc_insertion_point(destructor:helloworld.HelloRequest) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void HelloRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.name_.Destroy(); + _impl_.vhivemetadata_.Destroy(); +} + +void HelloRequest::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void HelloRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:helloworld.HelloRequest) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.name_.ClearToEmpty(); + _impl_.vhivemetadata_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* HelloRequest::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_name(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "helloworld.HelloRequest.name")); + } else + goto handle_unusual; + continue; + // bytes vHiveMetadata = 15; + case 15: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) { + auto str = _internal_mutable_vhivemetadata(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* HelloRequest::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:helloworld.HelloRequest) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // string name = 1; + if (!this->_internal_name().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_name().data(), static_cast(this->_internal_name().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "helloworld.HelloRequest.name"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_name(), target); + } + + // bytes vHiveMetadata = 15; + if (!this->_internal_vhivemetadata().empty()) { + target = stream->WriteBytesMaybeAliased( + 15, this->_internal_vhivemetadata(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:helloworld.HelloRequest) + return target; +} + +size_t HelloRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:helloworld.HelloRequest) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string name = 1; + if (!this->_internal_name().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // bytes vHiveMetadata = 15; + if (!this->_internal_vhivemetadata().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_vhivemetadata()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData HelloRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + HelloRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*HelloRequest::GetClassData() const { return &_class_data_; } + + +void HelloRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:helloworld.HelloRequest) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + if (!from._internal_vhivemetadata().empty()) { + _this->_internal_set_vhivemetadata(from._internal_vhivemetadata()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void HelloRequest::CopyFrom(const HelloRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:helloworld.HelloRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool HelloRequest::IsInitialized() const { + return true; +} + +void HelloRequest::InternalSwap(HelloRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.name_, lhs_arena, + &other->_impl_.name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.vhivemetadata_, lhs_arena, + &other->_impl_.vhivemetadata_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata HelloRequest::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_helloworld_2eproto_getter, &descriptor_table_helloworld_2eproto_once, + file_level_metadata_helloworld_2eproto[0]); +} + +// =================================================================== + +class HelloReply::_Internal { + public: +}; + +HelloReply::HelloReply(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:helloworld.HelloReply) +} +HelloReply::HelloReply(const HelloReply& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + HelloReply* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.message_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _impl_.message_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.message_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_message().empty()) { + _this->_impl_.message_.Set(from._internal_message(), + _this->GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:helloworld.HelloReply) +} + +inline void HelloReply::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.message_){} + , /*decltype(_impl_._cached_size_)*/{} + }; + _impl_.message_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.message_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +HelloReply::~HelloReply() { + // @@protoc_insertion_point(destructor:helloworld.HelloReply) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void HelloReply::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.message_.Destroy(); +} + +void HelloReply::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void HelloReply::Clear() { +// @@protoc_insertion_point(message_clear_start:helloworld.HelloReply) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.message_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* HelloReply::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string message = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_message(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "helloworld.HelloReply.message")); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* HelloReply::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:helloworld.HelloReply) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // string message = 1; + if (!this->_internal_message().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_message().data(), static_cast(this->_internal_message().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "helloworld.HelloReply.message"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_message(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:helloworld.HelloReply) + return target; +} + +size_t HelloReply::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:helloworld.HelloReply) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string message = 1; + if (!this->_internal_message().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_message()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData HelloReply::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + HelloReply::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*HelloReply::GetClassData() const { return &_class_data_; } + + +void HelloReply::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:helloworld.HelloReply) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_message().empty()) { + _this->_internal_set_message(from._internal_message()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void HelloReply::CopyFrom(const HelloReply& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:helloworld.HelloReply) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool HelloReply::IsInitialized() const { + return true; +} + +void HelloReply::InternalSwap(HelloReply* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.message_, lhs_arena, + &other->_impl_.message_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata HelloReply::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_helloworld_2eproto_getter, &descriptor_table_helloworld_2eproto_once, + file_level_metadata_helloworld_2eproto[1]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace helloworld +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::helloworld::HelloRequest* +Arena::CreateMaybeMessage< ::helloworld::HelloRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::helloworld::HelloRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::helloworld::HelloReply* +Arena::CreateMaybeMessage< ::helloworld::HelloReply >(Arena* arena) { + return Arena::CreateMessageInternal< ::helloworld::HelloReply >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/proto/helloworld/helloworld.pb.h b/proto/helloworld/helloworld.pb.h new file mode 100644 index 0000000..50638f5 --- /dev/null +++ b/proto/helloworld/helloworld.pb.h @@ -0,0 +1,561 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: helloworld.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_helloworld_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_helloworld_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3021003 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_helloworld_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_helloworld_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_helloworld_2eproto; +namespace helloworld { +class HelloReply; +struct HelloReplyDefaultTypeInternal; +extern HelloReplyDefaultTypeInternal _HelloReply_default_instance_; +class HelloRequest; +struct HelloRequestDefaultTypeInternal; +extern HelloRequestDefaultTypeInternal _HelloRequest_default_instance_; +} // namespace helloworld +PROTOBUF_NAMESPACE_OPEN +template<> ::helloworld::HelloReply* Arena::CreateMaybeMessage<::helloworld::HelloReply>(Arena*); +template<> ::helloworld::HelloRequest* Arena::CreateMaybeMessage<::helloworld::HelloRequest>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace helloworld { + +// =================================================================== + +class HelloRequest final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:helloworld.HelloRequest) */ { + public: + inline HelloRequest() : HelloRequest(nullptr) {} + ~HelloRequest() override; + explicit PROTOBUF_CONSTEXPR HelloRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + HelloRequest(const HelloRequest& from); + HelloRequest(HelloRequest&& from) noexcept + : HelloRequest() { + *this = ::std::move(from); + } + + inline HelloRequest& operator=(const HelloRequest& from) { + CopyFrom(from); + return *this; + } + inline HelloRequest& operator=(HelloRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const HelloRequest& default_instance() { + return *internal_default_instance(); + } + static inline const HelloRequest* internal_default_instance() { + return reinterpret_cast( + &_HelloRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(HelloRequest& a, HelloRequest& b) { + a.Swap(&b); + } + inline void Swap(HelloRequest* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HelloRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + HelloRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const HelloRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const HelloRequest& from) { + HelloRequest::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HelloRequest* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "helloworld.HelloRequest"; + } + protected: + explicit HelloRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNameFieldNumber = 1, + kVHiveMetadataFieldNumber = 15, + }; + // string name = 1; + void clear_name(); + const std::string& name() const; + template + void set_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* name); + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // bytes vHiveMetadata = 15; + void clear_vhivemetadata(); + const std::string& vhivemetadata() const; + template + void set_vhivemetadata(ArgT0&& arg0, ArgT... args); + std::string* mutable_vhivemetadata(); + PROTOBUF_NODISCARD std::string* release_vhivemetadata(); + void set_allocated_vhivemetadata(std::string* vhivemetadata); + private: + const std::string& _internal_vhivemetadata() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_vhivemetadata(const std::string& value); + std::string* _internal_mutable_vhivemetadata(); + public: + + // @@protoc_insertion_point(class_scope:helloworld.HelloRequest) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr vhivemetadata_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_helloworld_2eproto; +}; +// ------------------------------------------------------------------- + +class HelloReply final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:helloworld.HelloReply) */ { + public: + inline HelloReply() : HelloReply(nullptr) {} + ~HelloReply() override; + explicit PROTOBUF_CONSTEXPR HelloReply(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + HelloReply(const HelloReply& from); + HelloReply(HelloReply&& from) noexcept + : HelloReply() { + *this = ::std::move(from); + } + + inline HelloReply& operator=(const HelloReply& from) { + CopyFrom(from); + return *this; + } + inline HelloReply& operator=(HelloReply&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const HelloReply& default_instance() { + return *internal_default_instance(); + } + static inline const HelloReply* internal_default_instance() { + return reinterpret_cast( + &_HelloReply_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(HelloReply& a, HelloReply& b) { + a.Swap(&b); + } + inline void Swap(HelloReply* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HelloReply* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + HelloReply* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const HelloReply& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const HelloReply& from) { + HelloReply::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HelloReply* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "helloworld.HelloReply"; + } + protected: + explicit HelloReply(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMessageFieldNumber = 1, + }; + // string message = 1; + void clear_message(); + const std::string& message() const; + template + void set_message(ArgT0&& arg0, ArgT... args); + std::string* mutable_message(); + PROTOBUF_NODISCARD std::string* release_message(); + void set_allocated_message(std::string* message); + private: + const std::string& _internal_message() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_message(const std::string& value); + std::string* _internal_mutable_message(); + public: + + // @@protoc_insertion_point(class_scope:helloworld.HelloReply) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_helloworld_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// HelloRequest + +// string name = 1; +inline void HelloRequest::clear_name() { + _impl_.name_.ClearToEmpty(); +} +inline const std::string& HelloRequest::name() const { + // @@protoc_insertion_point(field_get:helloworld.HelloRequest.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void HelloRequest::set_name(ArgT0&& arg0, ArgT... args) { + + _impl_.name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:helloworld.HelloRequest.name) +} +inline std::string* HelloRequest::mutable_name() { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:helloworld.HelloRequest.name) + return _s; +} +inline const std::string& HelloRequest::_internal_name() const { + return _impl_.name_.Get(); +} +inline void HelloRequest::_internal_set_name(const std::string& value) { + + _impl_.name_.Set(value, GetArenaForAllocation()); +} +inline std::string* HelloRequest::_internal_mutable_name() { + + return _impl_.name_.Mutable(GetArenaForAllocation()); +} +inline std::string* HelloRequest::release_name() { + // @@protoc_insertion_point(field_release:helloworld.HelloRequest.name) + return _impl_.name_.Release(); +} +inline void HelloRequest::set_allocated_name(std::string* name) { + if (name != nullptr) { + + } else { + + } + _impl_.name_.SetAllocated(name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:helloworld.HelloRequest.name) +} + +// bytes vHiveMetadata = 15; +inline void HelloRequest::clear_vhivemetadata() { + _impl_.vhivemetadata_.ClearToEmpty(); +} +inline const std::string& HelloRequest::vhivemetadata() const { + // @@protoc_insertion_point(field_get:helloworld.HelloRequest.vHiveMetadata) + return _internal_vhivemetadata(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void HelloRequest::set_vhivemetadata(ArgT0&& arg0, ArgT... args) { + + _impl_.vhivemetadata_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:helloworld.HelloRequest.vHiveMetadata) +} +inline std::string* HelloRequest::mutable_vhivemetadata() { + std::string* _s = _internal_mutable_vhivemetadata(); + // @@protoc_insertion_point(field_mutable:helloworld.HelloRequest.vHiveMetadata) + return _s; +} +inline const std::string& HelloRequest::_internal_vhivemetadata() const { + return _impl_.vhivemetadata_.Get(); +} +inline void HelloRequest::_internal_set_vhivemetadata(const std::string& value) { + + _impl_.vhivemetadata_.Set(value, GetArenaForAllocation()); +} +inline std::string* HelloRequest::_internal_mutable_vhivemetadata() { + + return _impl_.vhivemetadata_.Mutable(GetArenaForAllocation()); +} +inline std::string* HelloRequest::release_vhivemetadata() { + // @@protoc_insertion_point(field_release:helloworld.HelloRequest.vHiveMetadata) + return _impl_.vhivemetadata_.Release(); +} +inline void HelloRequest::set_allocated_vhivemetadata(std::string* vhivemetadata) { + if (vhivemetadata != nullptr) { + + } else { + + } + _impl_.vhivemetadata_.SetAllocated(vhivemetadata, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.vhivemetadata_.IsDefault()) { + _impl_.vhivemetadata_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:helloworld.HelloRequest.vHiveMetadata) +} + +// ------------------------------------------------------------------- + +// HelloReply + +// string message = 1; +inline void HelloReply::clear_message() { + _impl_.message_.ClearToEmpty(); +} +inline const std::string& HelloReply::message() const { + // @@protoc_insertion_point(field_get:helloworld.HelloReply.message) + return _internal_message(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void HelloReply::set_message(ArgT0&& arg0, ArgT... args) { + + _impl_.message_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:helloworld.HelloReply.message) +} +inline std::string* HelloReply::mutable_message() { + std::string* _s = _internal_mutable_message(); + // @@protoc_insertion_point(field_mutable:helloworld.HelloReply.message) + return _s; +} +inline const std::string& HelloReply::_internal_message() const { + return _impl_.message_.Get(); +} +inline void HelloReply::_internal_set_message(const std::string& value) { + + _impl_.message_.Set(value, GetArenaForAllocation()); +} +inline std::string* HelloReply::_internal_mutable_message() { + + return _impl_.message_.Mutable(GetArenaForAllocation()); +} +inline std::string* HelloReply::release_message() { + // @@protoc_insertion_point(field_release:helloworld.HelloReply.message) + return _impl_.message_.Release(); +} +inline void HelloReply::set_allocated_message(std::string* message) { + if (message != nullptr) { + + } else { + + } + _impl_.message_.SetAllocated(message, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.message_.IsDefault()) { + _impl_.message_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:helloworld.HelloReply.message) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace helloworld + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_helloworld_2eproto