Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proto files for image-rotate benchmark #123

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ replace (
github.com/vhive-serverless/vSwarm-proto/proto/helloworld => ./proto/helloworld
github.com/vhive-serverless/vSwarm-proto/proto/hipstershop => ./proto/hipstershop
github.com/vhive-serverless/vSwarm-proto/proto/hotel_reserv => ./proto/hotel_reserv
github.com/vhive-serverless/vSwarm-proto/proto/image_rotate => ./proto/image_rotate
)

require (
Expand Down
5 changes: 5 additions & 0 deletions grpcclient/getclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ func FindServiceName(functionName string) string {
return "compression"
case "gptj-python":
return "gptj"
case "image-rotate-python", "image-rotate-nodejs", "image-rotate-go", "image-rotate-cython":
return "image-rotate"
case "spright-parking-python":
return "spright-parking"
default:
Expand Down Expand Up @@ -45,6 +47,9 @@ func FindGrpcClient(service_name string) GrpcClient {
case "gptj":
log.Debug("Found gptj client")
return new(GptJClient)
case "image-rotate":
log.Debug("Found image rotate client")
return new(ImageRotateClient)

// Hotel reservation ---
case "Geo", "geo":
Expand Down
4 changes: 2 additions & 2 deletions grpcclient/grpcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ func (c *ClientBase) Connect(ctx context.Context, ip, port string) error {
var err error
if tracing.IsTracingEnabled() {
log.Debug("Tracing is enabled.")
conn, err = tracing.DialGRPCWithUnaryInterceptor(address, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
conn, err = tracing.DialGRPCWithUnaryInterceptor(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
} else {
log.Debug("Tracing is disabled.")
conn, err = grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
conn, err = grpc.NewClient(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
}
if err != nil {
log.WithFields(
Expand Down
42 changes: 42 additions & 0 deletions grpcclient/image_rotate_client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package grpcclient

import (
"context"

pb "github.com/vhive-serverless/vSwarm-proto/proto/image_rotate"
)

type ImageRotateGenerator struct {
GeneratorBase
}

func (g *ImageRotateGenerator) Next() Input {
var pkt = g.defaultInput
return pkt
}

func (c *ImageRotateClient) GetGenerator() Generator {
return new(ImageRotateGenerator)
}

type ImageRotateClient struct {
ClientBase
client pb.ImageRotateClient
}

func (c *ImageRotateClient) Init(ctx context.Context, ip, port string) error {
err := c.Connect(ctx, ip, port)
if err != nil {
return err
}
c.client = pb.NewImageRotateClient(c.conn)
return nil
}

func (c *ImageRotateClient) Request(ctx context.Context, req Input) (string, error) {
r, err := c.client.RotateImage(ctx, &pb.SendImage{Name: req.Value})
if err != nil {
return "", err
}
return r.GetMessage(), nil
}
241 changes: 241 additions & 0 deletions proto/image_rotate/image_rotate.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions proto/image_rotate/image_rotate.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// MIT License

// Copyright (c) 2024 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/image_rotate";

package image_rotate;

// The greeting service definition.
service ImageRotate {
rpc RotateImage (SendImage) returns (GetRotatedImage) {}
}

// The request message containing the user's name.
message SendImage {
string name = 1;
}

// The response message containing the greetings
message GetRotatedImage {
string message = 1;
}
Loading
Loading