Skip to content

Commit df314aa

Browse files
committed
Implement RPC and generate pg.go files
1 parent 99a65b0 commit df314aa

File tree

3 files changed

+346
-3
lines changed

3 files changed

+346
-3
lines changed

proto/ratelimiter.pb.go

Lines changed: 227 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/ratelimiter.proto

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
// proto/ratelimiter.proto
1+
syntax = "proto3";
2+
3+
package ratelimiter.v1;
4+
5+
option go_package = "github.com/Pavan-Rana/rate-limiter/proto";
6+
7+
service RateLimiter {
8+
// Makes an atomic rate-limit decision for given API key
9+
rpc AllowRequest(AllowRequestMessage) returns (AllowResponse);
10+
}
11+
12+
message AllowRequestMessage {
13+
string api_key = 1;
14+
}
15+
16+
message AllowResponse {
17+
bool allowed = 1;
18+
// "allowed" | "rate limit exceeded" | "fail-open: <err>"
19+
string reason = 2;
20+
}

proto/ratelimiter_grpc.pb.go

Lines changed: 99 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)