Commit 5bf7c9a 1 parent 5bb1d51 commit 5bf7c9a Copy full SHA for 5bf7c9a
File tree 2 files changed +74
-7
lines changed
2 files changed +74
-7
lines changed Original file line number Diff line number Diff line change 1
- # /workspace
1
+ # kadb
2
2
3
- To install dependencies:
3
+ Lightning fast Immutable Key-Array Database.
4
4
5
+ # Common use cases
6
+
7
+ - Logging server
8
+ - Uneditable chat room/forum
9
+ - Uneditable mailbox
10
+
11
+ # Why ` kadb ` ?
12
+
13
+ - Write value: O(logn)
14
+ - Read subarray: O(logn)
15
+
16
+ _ n is the total number of key_
17
+
18
+ ## Implementation
19
+
20
+ - Linux's io_uring
21
+ - AVL Tree
22
+ - Array accumulated items length
23
+ - realloc strategy ` double `
24
+ - Single-threaded
25
+
26
+ ## Clone
5
27
``` bash
6
- bun install
28
+ git clone https://github.com/chientrm/kadb
7
29
```
8
30
9
- To run:
31
+ ## Build
10
32
11
33
``` bash
12
- bun run index.ts
34
+ cd kadb
35
+ ./configure
36
+ make kadb
13
37
```
14
38
15
- This project was created using ` bun init ` in bun v0.1.10. [ Bun] ( https://bun.sh ) is a fast all-in-one JavaScript runtime.
39
+ ## Start server
40
+
41
+ ``` bash
42
+ kadb
43
+ ```
44
+
45
+ ` Listening on http://localhost:8080 `
46
+
47
+ ## GET
48
+
49
+ Get ` 10 ` value of key ` key-1 ` from offset ` 0 `
50
+
51
+ ``` bash
52
+ curl http://localhost:8080/key-1/0000/0010
53
+ ```
54
+
55
+ Example result
56
+
57
+ ```
58
+ HTTP Header
59
+ ------------------------
60
+ Kadb-n_items: 2
61
+ Content-Type: text/plain
62
+ Content-Length: 13
63
+
64
+ HTTP Body
65
+ ------------------------
66
+ value1;value2;
67
+ ```
68
+
69
+ meaning key ` key-1 ` has total 2 items.
70
+
71
+ ## PUT
72
+
73
+ Put value ` 1234 ` to key ` abc ` .
74
+ ``` bash
75
+ curl http://localhost:8080/0003/0004/abc1234
76
+ ```
77
+
78
+ Result status code ` 200 `
79
+
80
+ ## Benchmarks
81
+
82
+ ...coming soon...
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ int ring_write_no_content(int socket)
199
199
200
200
uint8_t DATA_FMT [] =
201
201
"HTTP/1.0 200 OK\r\n"
202
- "Content-Type: plain/ text\r\n"
202
+ "Content-Type: text/plain \r\n"
203
203
"Content-Length: %zu\r\n"
204
204
"Kadb-n_items: %zu\r\n\r\n" ;
205
205
You can’t perform that action at this time.
0 commit comments