Commit Graph

85 Commits

Author SHA1 Message Date
Piotr Sarna
d4da54b10b mvcc: build static library for C bindings
That's how it's currently consumed by libSQL.
2023-05-09 10:28:26 +02:00
Pekka Enberg
f47eea1a72 Move DESIGN.md to docs 2023-05-09 11:00:00 +03:00
Pekka Enberg
19ea5c287b Merge pull request #27 from penberg/core
Rename database directory to mvcc-rs
2023-05-09 10:59:19 +03:00
Pekka Enberg
b9575c4375 Rename database directory to mvcc-rs 2023-05-09 10:56:46 +03:00
Pekka Enberg
cc4db340ee Merge pull request #26 from penberg/c-bindings
Improve C bindings
2023-05-09 10:51:39 +03:00
Pekka Enberg
41bed41544 Improve logging 2023-05-09 10:51:14 +03:00
Pekka Enberg
5ce2bc41f9 cargo fmt 2023-05-09 10:47:43 +03:00
Pekka Enberg
b2f46e156b Improve C binding error reporting 2023-05-09 10:47:40 +03:00
Pekka Enberg
3ecb0fb2a9 Mark MVCCDatabaseOpen() as unsafe 2023-05-09 10:44:06 +03:00
Pekka Enberg
db1e313aca Silence clippy 2023-05-09 10:43:42 +03:00
Pekka Enberg
1fc99181f1 Update README.md 2023-05-09 10:42:05 +03:00
Pekka Enberg
c94561a646 Add mvcc.h to the tree 2023-05-09 10:41:33 +03:00
Pekka Enberg
779ad3066a Add error codes to C bindings 2023-05-09 10:41:13 +03:00
Pekka Enberg
34a4f1a269 Improve generated C bindings
Before:

```c
typedef LocalClock Clock;

typedef JsonOnDisk Storage;

typedef DatabaseInner<Clock, Storage> Inner;

typedef Database<Clock, Storage, Mutex<Inner>> Db;

typedef struct {
  Db db;
  Runtime runtime;
} DbContext;

extern "C" {

DbContext *mvccrs_new_database(const char *path);

void mvccrs_free_database(Db *db);

int32_t mvccrs_insert(DbContext *db, uint64_t id, const uint8_t *value_ptr, uintptr_t value_len);

} // extern "C"

```

After:

```c

typedef struct DbContext DbContext;

typedef const DbContext *MVCCDatabaseRef;

extern "C" {

MVCCDatabaseRef MVCCDatabaseOpen(const char *path);

void MVCCDatabaseClose(MVCCDatabaseRef db);

int32_t MVCCDatabaseInsert(MVCCDatabaseRef db, uint64_t id, const uint8_t *value_ptr, uintptr_t value_len);

} // extern "C"

```
2023-05-09 10:34:11 +03:00
Pekka Enberg
124446f17c Generate C header file on cargo build 2023-05-09 10:34:11 +03:00
Pekka Enberg
d5b96d5edf Move C bindings to separate crate 2023-05-09 10:34:11 +03:00
Pekka Enberg
69cee068ce Merge pull request #25 from penberg/mvcc_write_cursor
add c_bindings feature for exposing functions to C
2023-05-08 15:59:07 +03:00
Piotr Sarna
488201cab2 add c_bindings feature for exposing functions to C
The library can now be compiled to a static or dynamic
native lib, with very basic functionality exposed.
2023-05-08 14:20:34 +02:00
Pekka Enberg
aac835fce9 Document persistent storage design (#24) 2023-05-06 20:15:08 +02:00
Pekka Enberg
eb52f3e1cd Merge pull request #23 from psarna/compact_rowversions 2023-04-25 18:56:44 +03:00
Piotr Sarna
fb6ce70993 database: add dropping unused row versions
When a row version is not visible by any transactions,
active or future ones, it should be dropped.
2023-04-20 15:47:36 +02:00
Piotr Sarna
2a018ea9a3 fixup: move DatabaseError under a feature 2023-04-20 15:47:36 +02:00
Pekka Enberg
851871d24b Merge pull request #22 from psarna/storfixup
fixup: implement Stream for JsonOnDiskStream under a feature
2023-04-20 16:03:51 +03:00
Piotr Sarna
b6b36a0d94 fixup: implement Stream for JsonOnDiskStream under a feature 2023-04-20 14:46:14 +02:00
Pekka Enberg
a94ee8666d Merge pull request #19 from psarna/storage_v1
Add persistent storage trait
2023-04-17 17:50:18 +03:00
Piotr Sarna
04a78f73fb treewide: add persistent storage trait
This draft adds a persistent storage trait that can be used
to store transaction logs and read the log for recovery purposes.
Work in heavy progress, because ideally the design should also
allow reading versions from the storage, so that data can be
spilled from memory to disk if there's not enough RAM available.
2023-04-17 14:46:39 +02:00
Piotr Sarna
7ca68b3d96 errors: Add I/O error class 2023-04-17 12:06:34 +02:00
Piotr Sarna
db71c7e4e3 database: make transactions (de)serializable 2023-04-17 12:06:22 +02:00
Pekka Enberg
028fb0cf0c Merge pull request #17 from penberg/tx-gc 2023-04-15 20:48:18 +03:00
Pekka Enberg
74a4d2d11a Garbage collect transactions
Fixes #2
2023-04-15 09:53:56 +03:00
Pekka Enberg
43544c9fb6 Update README.md 2023-04-14 21:32:31 +03:00
Pekka Enberg
c0881944e0 Update README.md 2023-04-14 21:31:19 +03:00
Pekka Enberg
438c342292 Merge pull request #16 from avinassh/visibility-bug
Bugfix: make committed rows visible (fixes #15)
2023-04-14 21:26:18 +03:00
avi
87b9b27215 check if tx can see its own updates 2023-04-14 22:56:07 +05:30
avi
e006177480 fix typos 2023-04-14 22:06:55 +05:30
avi
aff901baea bugfix: make committed rows visibile (fixes #15) 2023-04-14 21:59:35 +05:30
Pekka Enberg
686518d81c Merge pull request #14 from psarna/asyncify
Asyncify the APIs
2023-04-14 16:28:48 +03:00
Piotr Sarna
546db5a983 sync: add AsyncMutex trait
With AsyncMutex, we can use different mutex mechanisms
in the database - e.g. tokio::sync::Mutex.
2023-04-14 15:09:13 +02:00
Piotr Sarna
bfe3bcef71 asyncify
In order to prepare for #3, the APIs are made asynchronous.
It also applies to tests and benches.
2023-04-14 15:08:51 +02:00
Pekka Enberg
620b8c6362 Update README.md 2023-04-14 14:43:28 +03:00
Pekka Enberg
ecc9a8ba7d Merge pull request #13 from penberg/shrink-code
Minimize library binary size
2023-04-14 14:37:32 +03:00
Pekka Enberg
9247e44324 Minimize library binary size
Shrinks binary size from 319K to 282K.
2023-04-14 14:07:49 +03:00
Pekka Enberg
b8b8d3f746 Remove rustyline dependency
It's not needed, likely leftover from some previous prototyping.
2023-04-14 14:02:02 +03:00
Pekka Enberg
4a98d32ce1 Update README.md 2023-04-14 13:52:55 +03:00
Pekka Enberg
5f84604d67 Add some more micro-benchmarks 2023-04-14 13:50:24 +03:00
Pekka Enberg
f223615910 Merge pull request #12 from penberg/parking-lot
Switch to parking_lot mutex
2023-04-14 13:33:59 +03:00
Pekka Enberg
c87d6ee44e Merge pull request #11 from penberg/throughput-bench
Use Criterion's throughput estimation
2023-04-14 13:33:46 +03:00
Pekka Enberg
ed5e259cfe Switch to parking_lot mutex
It's faster than the standard library mutex.
2023-04-14 12:04:43 +03:00
Pekka Enberg
0f956fa179 Use Criterion's throughput estimation
Iteration time is of course interesting, but let's also use throughput
estimation on MVCC operations such as read(), begin_tx(), etc..
2023-04-14 11:59:36 +03:00
Pekka Enberg
e99f5d89fc Merge pull request #10 from psarna/fixci2
simplify CI
2023-04-14 11:51:57 +03:00