forked from stefanprodan/podinfo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request stefanprodan#369 from Prashant-Dwivedi-08-01/grpc_…
…APIs GRPC Apis for Corresponding HTTP APIs
- Loading branch information
Showing
39 changed files
with
2,943 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package grpc | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
pb "github.com/stefanprodan/podinfo/pkg/api/grpc/delay" | ||
"go.uber.org/zap" | ||
) | ||
|
||
type DelayServer struct { | ||
pb.UnimplementedDelayServiceServer | ||
config *Config | ||
logger *zap.Logger | ||
} | ||
|
||
func (s *DelayServer) Delay(ctx context.Context, delayInput *pb.DelayRequest) (*pb.DelayResponse, error) { | ||
|
||
time.Sleep(time.Duration(delayInput.Seconds) * time.Second) | ||
return &pb.DelayResponse{Message: delayInput.Seconds}, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
syntax = "proto3"; | ||
|
||
option go_package = "./delay"; | ||
|
||
package delay; | ||
|
||
message DelayRequest { | ||
int64 seconds = 1; | ||
} | ||
|
||
message DelayResponse { | ||
int64 message = 1; | ||
} | ||
|
||
service DelayService { | ||
rpc Delay (DelayRequest) returns (DelayResponse) {} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.