Skip to content

Commit ace7c03

Browse files
author
Patrick Koss
committed
add more readme stuff
1 parent e3d7dde commit ace7c03

File tree

4 files changed

+84
-4
lines changed

4 files changed

+84
-4
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
run-all-docker:
1+
run-all-docker: run-zookeeper
22
docker-compose up router server server2 server3 server4 envoy
33

4+
run-zookeeper:
5+
docker-compose up zoo1 zoo2 zoo3
6+
47
test:
58
for dir in $$(find . -type d); do \
69
if [ -f $$dir/Cargo.toml ]; then \

README.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
</p>
44

55
# PatrickDB
6+
67
![Build Status](https://img.shields.io/travis/com/patrickkoss/patrick-db/master)
78
![Coverage](https://img.shields.io/codecov/c/github/patrickkoss/patrick-db)
89
![License](https://img.shields.io/github/license/patrickkoss/patrick-db)
@@ -11,9 +12,8 @@
1112
![PRs](https://img.shields.io/github/issues-pr/patrickkoss/patrick-db)
1213
![Forks](https://img.shields.io/github/forks/patrickkoss/patrick-db)
1314
![Stars](https://img.shields.io/github/stars/patrickkoss/patrick-db)
14-
![Language](https://img.shields.io/github/languages/top/patrickkoss/patrick-db
1515

16-
patrick-db is a simplified Rust-based database designed to demonstrate distributed database principles. This distributed
16+
PatrickDB is a simplified Rust-based database designed to demonstrate distributed database principles. This distributed
1717
key-value store employs Zookeeper for replication and partitioning. Data is stored in a row-based format using a
1818
file-based system.
1919

@@ -24,7 +24,8 @@ patrick-db's storage and index engines can be integrated into other projects.
2424

2525
![Architecture](./media/architecture.png)
2626

27-
Clients compatible with gRPC or REST can connect to patrick-db, such as the [cli](./server/src/client.rs) tool located in
27+
Clients compatible with gRPC or REST can connect to patrick-db, such as the [cli](./server/src/client.rs) tool located
28+
in
2829
the [server](./server) directory.
2930

3031
Envoy, which serves multiple purposes, is used here to interchange REST and gRPC.
@@ -38,3 +39,24 @@ is chosen.
3839

3940
The [database](server/src/server.rs) itself is a gRPC server that implements a file-based storage system. In its role as
4041
a leader, it replicates data to followers using statement replication.
42+
43+
# Getting Started
44+
45+
Start all components (Zookeeper, Envoy, Router, and two Partitions with one Leader and Replica) inside docker
46+
containers:
47+
48+
```bash
49+
make run-all-docker
50+
```
51+
52+
Lint all components:
53+
54+
```bash
55+
make lint
56+
```
57+
58+
Run all tests:
59+
60+
```bash
61+
make test
62+
```

server/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,12 @@ PROTOC_GEN_GO_GRPC = bin/protoc-gen-go-grpc
6666
install-protoc-gen-go-grpc: $(PROTOC_GEN_GO_GRPC)
6767
$(PROTOC_GEN_GO_GRPC):
6868
GOBIN=$(PWD)/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
69+
70+
run-router:
71+
cargo run --bin router
72+
73+
run-server:
74+
cargo run --bin server
75+
76+
run-follower:
77+
cargo run --bin server -- --server-address="[::1]:50053" --server-url="http://[::1]:50053" --storage-file-name=patrick2.db

server/README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Introduction
2+
3+
The server utilizes gRPC, implemented using [tonic](https://github.com/hyperium/tonic), and
4+
employs [buf](https://buf.build/docs/introduction) for downloading and compiling external dependencies. This includes
5+
tools like gnostic for OpenAPI generation and validate for validation purposes.
6+
7+
For building, compiling, downloading, and generating all proto-related materials, execute the following command:
8+
9+
```bash
10+
make build-proto
11+
```
12+
13+
## Running the server
14+
15+
To run any component in this directory ensure zookeeper is running with the following command:
16+
17+
```bash
18+
cd .. && make run-zookeeper
19+
```
20+
21+
To run the router execute the following command:
22+
23+
```bash
24+
make run-router
25+
```
26+
27+
To run the server execute the following command:
28+
29+
```bash
30+
make run-server
31+
```
32+
33+
Optionally, you can run another server as follower:
34+
35+
```bash
36+
make run-follower
37+
```
38+
39+
## Interacting with the server
40+
41+
To interact with the server, you can use the cli tool:
42+
43+
```bash
44+
cargo run --bin client -- add test test
45+
cargo run --bin client -- get test
46+
```

0 commit comments

Comments
 (0)