Skip to content

Commit e868a33

Browse files
Lakshmandhschall
authored andcommitted
Added all proto files for the image-rotate benchmark.
Modified code-quality workflow Signed-off-by: Lakshman <[email protected]>
1 parent d47bd5d commit e868a33

File tree

9 files changed

+565
-2
lines changed

9 files changed

+565
-2
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ replace (
1212
github.com/vhive-serverless/vSwarm-proto/proto/helloworld => ./proto/helloworld
1313
github.com/vhive-serverless/vSwarm-proto/proto/hipstershop => ./proto/hipstershop
1414
github.com/vhive-serverless/vSwarm-proto/proto/hotel_reserv => ./proto/hotel_reserv
15+
github.com/vhive-serverless/vSwarm-proto/proto/image_rotate => ./proto/image_rotate
1516
)
1617

1718
require (

grpcclient/getclient.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ func FindServiceName(functionName string) string {
1616
return "compression"
1717
case "gptj-python":
1818
return "gptj"
19+
case "image-rotate-python", "image-rotate-nodejs", "image-rotate-go", "image-rotate-cython":
20+
return "image-rotate"
1921
case "spright-parking-python":
2022
return "spright-parking"
2123
default:
@@ -45,6 +47,9 @@ func FindGrpcClient(service_name string) GrpcClient {
4547
case "gptj":
4648
log.Debug("Found gptj client")
4749
return new(GptJClient)
50+
case "image-rotate":
51+
log.Debug("Found image rotate client")
52+
return new(ImageRotateClient)
4853

4954
// Hotel reservation ---
5055
case "Geo", "geo":

grpcclient/grpcclient.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ func (c *ClientBase) Connect(ctx context.Context, ip, port string) error {
114114
var err error
115115
if tracing.IsTracingEnabled() {
116116
log.Debug("Tracing is enabled.")
117-
conn, err = tracing.DialGRPCWithUnaryInterceptor(address, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
117+
conn, err = tracing.DialGRPCWithUnaryInterceptor(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
118118
} else {
119119
log.Debug("Tracing is disabled.")
120-
conn, err = grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
120+
conn, err = grpc.NewClient(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
121121
}
122122
if err != nil {
123123
log.WithFields(

grpcclient/image_rotate_client.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package grpcclient
2+
3+
import (
4+
"context"
5+
6+
pb "github.com/vhive-serverless/vSwarm-proto/proto/image_rotate"
7+
)
8+
9+
type ImageRotateGenerator struct {
10+
GeneratorBase
11+
}
12+
13+
func (g *ImageRotateGenerator) Next() Input {
14+
var pkt = g.defaultInput
15+
return pkt
16+
}
17+
18+
func (c *ImageRotateClient) GetGenerator() Generator {
19+
return new(ImageRotateGenerator)
20+
}
21+
22+
type ImageRotateClient struct {
23+
ClientBase
24+
client pb.ImageRotateClient
25+
}
26+
27+
func (c *ImageRotateClient) Init(ctx context.Context, ip, port string) error {
28+
err := c.Connect(ctx, ip, port)
29+
if err != nil {
30+
return err
31+
}
32+
c.client = pb.NewImageRotateClient(c.conn)
33+
return nil
34+
}
35+
36+
func (c *ImageRotateClient) Request(ctx context.Context, req Input) (string, error) {
37+
r, err := c.client.RotateImage(ctx, &pb.SendImage{Name: req.Value})
38+
if err != nil {
39+
return "", err
40+
}
41+
return r.GetMessage(), nil
42+
}

proto/image_rotate/image_rotate.pb.go

Lines changed: 241 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// MIT License
2+
3+
// Copyright (c) 2024 EASE Lab
4+
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
12+
// The above copyright notice and this permission notice shall be included in all
13+
// copies or substantial portions of the Software.
14+
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
// SOFTWARE.
22+
23+
24+
syntax = "proto3";
25+
26+
option go_package = "github.com/vhive-serverless/vSwarm-proto/proto/image_rotate";
27+
28+
package image_rotate;
29+
30+
// The greeting service definition.
31+
service ImageRotate {
32+
rpc RotateImage (SendImage) returns (GetRotatedImage) {}
33+
}
34+
35+
// The request message containing the user's name.
36+
message SendImage {
37+
string name = 1;
38+
}
39+
40+
// The response message containing the greetings
41+
message GetRotatedImage {
42+
string message = 1;
43+
}

0 commit comments

Comments
 (0)