Skip to content

Commit e3d7dde

Browse files
author
Patrick Koss
committed
first readme draft
1 parent 126387f commit e3d7dde

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ test:
88
(cd $$dir && cargo test); \
99
fi \
1010
done
11+
12+
lint:
13+
for dir in $$(find . -type d); do \
14+
if [ -f $$dir/Cargo.toml ]; then \
15+
echo "Running lint in $$dir"; \
16+
(cd $$dir && cargo clippy); \
17+
fi \
18+
done

README.md

+40-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1-
# patrick-db
1+
<p align="center">
2+
<img src="./media/thumbnail.png">
3+
</p>
4+
5+
# PatrickDB
6+
![Build Status](https://img.shields.io/travis/com/patrickkoss/patrick-db/master)
7+
![Coverage](https://img.shields.io/codecov/c/github/patrickkoss/patrick-db)
8+
![License](https://img.shields.io/github/license/patrickkoss/patrick-db)
9+
![Version](https://img.shields.io/github/v/release/patrickkoss/patrick-db)
10+
![Issues](https://img.shields.io/github/issues-raw/patrickkoss/patrick-db)
11+
![PRs](https://img.shields.io/github/issues-pr/patrickkoss/patrick-db)
12+
![Forks](https://img.shields.io/github/forks/patrickkoss/patrick-db)
13+
![Stars](https://img.shields.io/github/stars/patrickkoss/patrick-db)
14+
![Language](https://img.shields.io/github/languages/top/patrickkoss/patrick-db
15+
16+
patrick-db is a simplified Rust-based database designed to demonstrate distributed database principles. This distributed
17+
key-value store employs Zookeeper for replication and partitioning. Data is stored in a row-based format using a
18+
file-based system.
19+
20+
The database is accessible through gRPC or REST, facilitated by Envoy for converting REST to gRPC. Additionally,
21+
patrick-db's storage and index engines can be integrated into other projects.
22+
23+
# Architecture
24+
25+
![Architecture](./media/architecture.png)
26+
27+
Clients compatible with gRPC or REST can connect to patrick-db, such as the [cli](./server/src/client.rs) tool located in
28+
the [server](./server) directory.
29+
30+
Envoy, which serves multiple purposes, is used here to interchange REST and gRPC.
31+
32+
Zookeeper plays a role in service discovery and managing leader elections.
33+
34+
The [router](server/src/router.rs), a gRPC server akin to the database server, interacts with Zookeeper. It identifies
35+
all partitions and their respective leaders and followers, directing traffic to the appropriate partition through
36+
hash-based partitioning. For write or read operations, it selects the leader, and for read-only operations, a follower
37+
is chosen.
38+
39+
The [database](server/src/server.rs) itself is a gRPC server that implements a file-based storage system. In its role as
40+
a leader, it replicates data to followers using statement replication.

configmanager/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn register_service(zk_arc: &Arc<ZooKeeper>, service_id: &str, service_registry_
212212

213213
let instance = Instance {
214214
id: service_id.to_owned(),
215-
is_leader: is_leader,
215+
is_leader,
216216
address: instance_address.to_string(),
217217
};
218218
let buf = bincode::serialize(&instance)?;
@@ -228,7 +228,7 @@ fn update_service(zk_arc: &Arc<ZooKeeper>, service_id: &str, service_registry_pa
228228

229229
let instance = Instance {
230230
id: service_id.to_owned(),
231-
is_leader: is_leader,
231+
is_leader,
232232
address: instance_address.to_string(),
233233
};
234234
let buf = bincode::serialize(&instance)?;

media/architecture.png

169 KB
Loading

media/thumbnail.png

1.04 MB
Loading

0 commit comments

Comments
 (0)