Skip to content

Commit 5bf7c9a

Browse files
committed
fix
1 parent 5bb1d51 commit 5bf7c9a

File tree

2 files changed

+74
-7
lines changed

2 files changed

+74
-7
lines changed

README.md

+73-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,82 @@
1-
# /workspace
1+
# kadb
22

3-
To install dependencies:
3+
Lightning fast Immutable Key-Array Database.
44

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
527
```bash
6-
bun install
28+
git clone https://github.com/chientrm/kadb
729
```
830

9-
To run:
31+
## Build
1032

1133
```bash
12-
bun run index.ts
34+
cd kadb
35+
./configure
36+
make kadb
1337
```
1438

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...

src/ring.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int ring_write_no_content(int socket)
199199

200200
uint8_t DATA_FMT[] =
201201
"HTTP/1.0 200 OK\r\n"
202-
"Content-Type: plain/text\r\n"
202+
"Content-Type: text/plain\r\n"
203203
"Content-Length: %zu\r\n"
204204
"Kadb-n_items: %zu\r\n\r\n";
205205

0 commit comments

Comments
 (0)