Skip to content

Commit 5618946

Browse files
committed
adding proto files
1 parent cfba65a commit 5618946

File tree

6 files changed

+424
-0
lines changed

6 files changed

+424
-0
lines changed

buf.gen.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
version: v1
3+
plugins:
4+
- plugin: go
5+
out: gen
6+
opt:
7+
- paths=import
8+
- module=github.com/binarymatt/kayak/gen
9+
- plugin: connect-go
10+
out: gen
11+
opt:
12+
- paths=import
13+
- module=github.com/binarymatt/kayak/gen
14+
- plugin: buf.build/bufbuild/validate-go
15+
out: gen
16+
opt:
17+
- paths=import
18+
- module=github.com/binarymatt/kayak/gen
19+
- plugin: go-grpc
20+
out: gen
21+
opt:
22+
- paths=import
23+
- module=github.com/binarymatt/kayak/gen
24+
- require_unimplemented_servers=false

buf.lock

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by buf. DO NOT EDIT.
2+
version: v1
3+
deps:
4+
- remote: buf.build
5+
owner: bufbuild
6+
repository: protovalidate
7+
commit: ca37dc8895db4729ac94f62f00fbd994
8+
digest: shake256:42c51d9091a313379dfdb0482cd86d2de412eb856721ac637bc8ff986694fd27924214440681f678c4c9dd2c24af0b4f59caf53e60d6fd1caa48c2d66d6c0425
9+
- remote: buf.build
10+
owner: envoyproxy
11+
repository: protoc-gen-validate
12+
commit: 6607b10f00ed4a3d98f906807131c44a
13+
digest: shake256:acc7b2ededb2f88d296862943a003b157bdb68ec93ed13dcd8566b2d06e47993ea6daf12013b9655658aaf6bbdb141cf65bfe400ce2870f4654b0a5b45e57c09
14+
- remote: buf.build
15+
owner: googleapis
16+
repository: googleapis
17+
commit: cc916c31859748a68fd229a3c8d7a2e8
18+
digest: shake256:469b049d0eb04203d5272062636c078decefc96fec69739159c25d85349c50c34c7706918a8b216c5c27f76939df48452148cff8c5c3ae77fa6ba5c25c1b8bf8

buf.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
version: v1
3+
deps:
4+
- buf.build/googleapis/googleapis
5+
- buf.build/envoyproxy/protoc-gen-validate
6+
- buf.build/bufbuild/protovalidate
7+
lint:
8+
use:
9+
- BASIC
10+
breaking:
11+
use:
12+
- FILE

proto/admin/v1/admin.proto

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
syntax = "proto3";
2+
3+
package admin.v1;
4+
5+
import "buf/validate/validate.proto";
6+
import "google/protobuf/empty.proto";
7+
8+
option go_package = "github.com/binarymatt/kayak/gen/admin/v1;adminv1";
9+
10+
service AdminService {
11+
rpc AddNonvoter(AddNonvoterRequest) returns (Future) {}
12+
rpc AddVoter(AddVoterRequest) returns (Future) {}
13+
rpc AppliedIndex(AppliedIndexRequest) returns (AppliedIndexResponse) {}
14+
rpc DemoteVoter(DemoteVoterRequest) returns (Future) {}
15+
rpc GetConfiguration(GetConfigurationRequest) returns (GetConfigurationResponse) {}
16+
rpc LastContact(LastContactRequest) returns (LastContactResponse) {}
17+
rpc LastIndex(LastIndexRequest) returns (LastIndexResponse) {}
18+
rpc Leader(LeaderRequest) returns (LeaderResponse) {}
19+
rpc LeadershipTransfer(LeadershipTransferRequest) returns (Future) {}
20+
rpc LeadershipTransferToServer(LeadershipTransferToServerRequest) returns (Future) {}
21+
rpc RemoveServer(RemoveServerRequest) returns (Future) {}
22+
rpc Shutdown(ShutdownRequest) returns (Future) {}
23+
rpc Snapshot(SnapshotRequest) returns (Future) {}
24+
rpc State(StateRequest) returns (StateResponse) {}
25+
rpc VerifyLeader(VerifyLeaderRequest) returns (Future) {}
26+
rpc Join(JoinRequest) returns (google.protobuf.Empty) {}
27+
28+
rpc Await(Future) returns (AwaitResponse) {}
29+
rpc Forget(Future) returns (ForgetResponse) {}
30+
}
31+
32+
message Future {
33+
string operation_token = 1;
34+
}
35+
36+
message AwaitResponse {
37+
string error = 1;
38+
uint64 index = 2;
39+
}
40+
41+
message ForgetResponse {}
42+
43+
message AddVoterRequest {
44+
string id = 1;
45+
string address = 2;
46+
uint64 previous_index = 3;
47+
}
48+
49+
message AddNonvoterRequest {
50+
string id = 1;
51+
string address = 2;
52+
uint64 previous_index = 3;
53+
}
54+
55+
message AppliedIndexRequest {}
56+
57+
message AppliedIndexResponse {
58+
uint64 index = 1;
59+
}
60+
message DemoteVoterRequest {
61+
string id = 1;
62+
uint64 previous_index = 2;
63+
}
64+
65+
message GetConfigurationRequest {}
66+
67+
message GetConfigurationResponse {
68+
message Server {
69+
enum Suffrage {
70+
VOTER = 0;
71+
NONVOTER = 1;
72+
STAGING = 2;
73+
}
74+
Suffrage suffrage = 1;
75+
string id = 2;
76+
string address = 3;
77+
}
78+
79+
repeated Server servers = 1;
80+
}
81+
82+
message LastContactRequest {}
83+
84+
message LastContactResponse {
85+
int64 unix_nano = 1;
86+
}
87+
88+
message LastIndexRequest {}
89+
90+
message LastIndexResponse {
91+
uint64 index = 1;
92+
}
93+
94+
message LeaderRequest {}
95+
96+
message LeaderResponse {
97+
string id = 1;
98+
string address = 2;
99+
}
100+
101+
message LeadershipTransferRequest {}
102+
103+
message LeadershipTransferToServerRequest {
104+
string id = 1;
105+
string address = 2;
106+
}
107+
108+
message RemoveServerRequest {
109+
string id = 1;
110+
uint64 previous_index = 2;
111+
}
112+
113+
message ShutdownRequest {}
114+
115+
message SnapshotRequest {}
116+
117+
message StateRequest {}
118+
119+
message StateResponse {
120+
enum State {
121+
FOLLOWER = 0;
122+
CANDIDATE = 1;
123+
LEADER = 2;
124+
SHUTDOWN = 3;
125+
}
126+
State state = 1;
127+
}
128+
129+
message VerifyLeaderRequest {}
130+
131+
message JoinRequest {
132+
string address = 1 [(buf.validate.field).string.uri_ref = true];
133+
}

proto/kayak/v1/kayak.proto

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
syntax = "proto3";
2+
3+
package kayak.v1;
4+
5+
import "buf/validate/validate.proto";
6+
import "google/protobuf/duration.proto";
7+
import "google/protobuf/empty.proto";
8+
import "google/protobuf/timestamp.proto";
9+
10+
option go_package = "github.com/binarymatt/kayak/gen/kayak/v1;kayakv1";
11+
12+
service KayakService {
13+
rpc PutRecords(PutRecordsRequest) returns (google.protobuf.Empty) {}
14+
rpc CommitRecord(CommitRecordRequest) returns (google.protobuf.Empty) {}
15+
rpc Apply(Command) returns (google.protobuf.Empty) {}
16+
17+
rpc GetRecords(GetRecordsRequest) returns (GetRecordsResponse) {}
18+
rpc FetchRecord(FetchRecordRequest) returns (FetchRecordsResponse) {}
19+
rpc StreamRecords(StreamRecordsRequest) returns (stream Record) {}
20+
rpc CreateTopic(CreateTopicRequest) returns (google.protobuf.Empty) {}
21+
rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) {}
22+
rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) {}
23+
24+
rpc Stats(google.protobuf.Empty) returns (StatsResponse) {}
25+
rpc GetNodeDetails(google.protobuf.Empty) returns (GetNodeDetailsResponse) {}
26+
}
27+
message CommitRecordRequest {
28+
string topic = 1;
29+
string consumer_id = 2;
30+
string position = 3;
31+
}
32+
33+
message PutRecordsRequest {
34+
string topic = 1 [(buf.validate.field).string.min_len = 1];
35+
repeated Record records = 2 [
36+
(buf.validate.field).repeated.min_items = 1,
37+
(buf.validate.field).repeated.max_items = 100
38+
];
39+
string idempotency_key = 3;
40+
}
41+
message Record {
42+
string topic = 1;
43+
string partition = 2;
44+
string id = 3;
45+
map<string, string> headers = 4;
46+
bytes payload = 5 [(buf.validate.field).bytes.min_len = 1];
47+
}
48+
49+
message FetchRecordRequest {
50+
// topic is the topic to get records from
51+
string topic = 1 [(buf.validate.field).string.min_len = 1];
52+
// consumer_group, if passed, will tell kayak what position to start from
53+
string consumer_id = 2;
54+
// position is where in the stream to start consuming.
55+
string position = 3;
56+
}
57+
58+
message FetchRecordsResponse {
59+
Record record = 1;
60+
}
61+
62+
message GetRecordsRequest {
63+
string topic = 1 [(buf.validate.field).string.min_len = 1];
64+
string start = 2;
65+
int32 limit = 3;
66+
}
67+
68+
message GetRecordsResponse {
69+
repeated Record records = 1;
70+
}
71+
72+
message CreateTopicRequest {
73+
string name = 1;
74+
}
75+
message DeleteTopicRequest {
76+
string topic = 1 [(buf.validate.field).required = true];
77+
}
78+
message Topic {
79+
string name = 1;
80+
int64 partitions = 2;
81+
}
82+
message ListTopicsRequest {}
83+
message ListTopicsResponse {
84+
repeated Topic topics = 1;
85+
}
86+
message StatsResponse {
87+
map<string, string> raft = 1;
88+
map<string, TopicMetadata> store = 2;
89+
}
90+
91+
message Command {
92+
oneof payload {
93+
PutRecordsRequest put_records_request = 1;
94+
CreateTopicRequest create_topic_request = 2;
95+
CommitRecordRequest commit_record_request = 3;
96+
DeleteTopicRequest delete_topic_request = 4;
97+
}
98+
}
99+
100+
message GetNodeDetailsResponse {
101+
string id = 1;
102+
int32 port = 2;
103+
}
104+
105+
message KVItem {
106+
bytes key = 1;
107+
bytes value = 2;
108+
bytes bucket = 3;
109+
}
110+
111+
message StreamRecordsRequest {
112+
// topic is the topic to get records from
113+
string topic = 1 [(buf.validate.field).string.min_len = 1];
114+
// position is where in the stream to start consuming.
115+
string position = 2;
116+
// batch_size indicates how many records to pull at once. If a value of 0 is given, service defaults to 1.
117+
int32 batch_size = 3;
118+
// timeout is when the server should return if no new records are found.
119+
google.protobuf.Duration timeout = 4;
120+
}
121+
122+
message TopicMetadata {
123+
string name = 1;
124+
int64 record_count = 2;
125+
google.protobuf.Timestamp created_at = 3;
126+
bool archived = 4;
127+
map<string, string> consumers = 5;
128+
}

0 commit comments

Comments
 (0)