๐ŸŒ AIๆœ็ดข & ไปฃ็† ไธป้กต
Skip to content

Commit dc59786

Browse files
committed
Update raftable README.
1 parent 87d5a0d commit dc59786

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

โ€Žcontrib/raftable/READMEโ€Ž

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
11
This extension allows you to have a key-value table replicated between several
22
Postgres instances over Raft protocol.
33

4+
Each 'postgres' instance starts a background worker 'raftable' and creates a
5+
shared memory segment for storing the 'state'. All 'raftable' workers are
6+
communicating Raft protocol over UDP.
7+
8+
When 'frontend' issues a read command, the 'backend' returns the data from the
9+
local replica of the 'state' which is in the shared memory of current instance.
10+
11+
When 'frontend' issues a write command, the 'backend' connects to the current
12+
'raftable' leader directly through TCP. Raftable leader returns the state
13+
version number V after the update gets applied (acked by the majority of
14+
'raftable' workers). Then the backend waits until the local state version
15+
number becomes at least V and returns 'ok' to the frontend.
16+
17+
The backend can also issue commands to itself through C API.
18+
19+
fork โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“ sql โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
20+
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ backend โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ frontend โ”ƒ
21+
โ”‚ โ”—โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”ฏโ”› โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›
22+
โ”‚ โ”‚shm โ”‚
23+
โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”“ โ”โ”โ”โ”โ”ทโ”โ”โ”โ”“ โ”‚
24+
โ”ƒ postgres โ” โ”€โ”€โ”€โ”€โ”จ state โ”ƒ โ”‚
25+
โ”—โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”› โ”—โ”โ”โ”โ”ฏโ”โ”โ”โ”› โ”‚ tcp
26+
โ”‚ โ”‚shm โ”‚
27+
โ”‚ fork โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”“ โ”‚
28+
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ raftable โ”ƒ โ”‚
29+
โ”—โ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”ฏโ”โ”ฏโ”› โ”‚
30+
โ”‚ raftโ”‚ โ”‚ โ”‚
31+
โ”โ”โ”ทโ”โ”ทโ”โ”ทโ”โ”ทโ”โ”ทโ”“ โ”‚
32+
โ”โ”ปโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“โ” โ”€โ”˜
33+
โ”โ”ปโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“โ”ฃโ”›
34+
โ”ƒ raftable โ”ฃโ”›
35+
โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›
36+
437
C API:
538
/* Gets value by key. Returns the value or NULL if not found. */
639
char *raftable_get(int key);
740

841
/*
9-
* Adds/updates value by key. Returns when the value gets replicated.
10-
* Storing NULL will delete the item from the table.
42+
* Adds/updates value by key. Returns when the value gets replicated on
43+
* current machine. Storing NULL will delete the item from the table.
1144
*/
1245
void raftable_set(int key, char *value);
1346

0 commit comments

Comments
ย (0)