Skip to content

Commit

Permalink
feat: Add source code for "Discover Servers and Load Balance from the…
Browse files Browse the repository at this point in the history
… Client" chapter - part 2 (#42)
  • Loading branch information
igor-baiborodine authored Mar 16, 2023
1 parent b6643ff commit a5321d0
Show file tree
Hide file tree
Showing 13 changed files with 753 additions and 99 deletions.
8 changes: 0 additions & 8 deletions ClientSideServiceDiscovery/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
## Discover Servers and Load Balance from the Client

### Prerequisites

#### Raft

```shell
go install github.com/hashicorp/raft@latest
```

### Tests

```shell
Expand Down
287 changes: 246 additions & 41 deletions ClientSideServiceDiscovery/api/v1/log.pb.go

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

18 changes: 16 additions & 2 deletions ClientSideServiceDiscovery/api/v1/log.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ service Log {
rpc Produce(ProduceRequest) returns (ProduceResponse) {}
rpc Consume(ConsumeRequest) returns (ConsumeResponse) {}
rpc ConsumeStream(ConsumeRequest) returns (stream ConsumeResponse) {}
rpc ProduceStream(stream ProduceRequest) returns (stream ProduceResponse) {}
rpc ProduceStream(stream ProduceRequest) returns (stream ProduceResponse)
{}
rpc GetServers(GetServersRequest) returns (GetServersResponse) {}
}

message ProduceRequest {
Expand All @@ -28,8 +30,20 @@ message ConsumeResponse {
}

message Record {
bytes value = 1;
bytes value = 1;
uint64 offset = 2;
uint64 term = 3;
uint32 type = 4;
}

message GetServersRequest {}

message GetServersResponse {
repeated Server servers = 1;
}

message Server {
string id = 1;
string rpc_addr = 2;
bool is_leader = 3;
}
Loading

0 comments on commit a5321d0

Please sign in to comment.