Commit 48c6111
Refactor vfs setup (#156)
* Refactor vfs setup
This change refactors the VFS setup to make different VFS implementations reusable by other projects. Specifically the memvfs implementation is untied from sqlite-wasm-rs so that it can be used with any rust sqlite project. For this we refactor the crate structure slightly. Instead of having a single sqlite-wasm-rs crate containing all relevant code we now have:
* wsqlite3-sys which contains the bindings and handles linking the actual sqlite library
* rsqlite-vfs which contains vfs definitions and memvfs implementation. This crate conditionally depends on libsqlite3-sys or sqlite-wasm-rs depending on the compilation target. So it can be used for different vfs implementations for different targets
* sqlite-wasm-rs which is now essentially only a shim over the other crates reexporting most of them in the old locations + providing some platform specific impls. This mostly concerns randomness and timestamp access for wasm
Platform specific behavior like randomness and timestamp access for the vfs implementations must be provided by the user by providing a type that handles callbacks for these cases. Otherwise the implementation can be shared. The reason for this is that the implementation of these platform specific function widly differ between platforms, for wasm you need to use web specific methods, for std targets you can use the standard library, for embedded platforms you would likely need to provide custom implementations.
The wsqlite3-sys and rsqlite-vfs crate are implemented as ![no_std] crates.
* pass `slqite3mc` feature
* Efficient copy
* Add WasmOsCallback random fallback
* Remove unused deps
---------
Co-authored-by: Spxg <unsafe@outlook.es>1 parent c9e3bd2 commit 48c6111
File tree
88 files changed
+707
-79
lines changed- .github/workflows
- crates
- rsqlite-vfs
- src
- sqlite-wasm-vfs/src
- wsqlite3-sys
- shim
- musl
- arch/generic/bits
- errno
- include
- internal
- math
- stdio
- stdlib
- string
- printf
- sqlite3mc
- sqlite3
- src
- bindgen
- examples/implement-a-vfs/src
- extensions/sqlite-vec/cc
- src
- tests/tests/full
- vfs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
88 files changed
+707
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | | - | |
8 | | - | |
9 | 5 | | |
10 | 6 | | |
11 | 7 | | |
12 | 8 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
27 | 14 | | |
28 | 15 | | |
29 | 16 | | |
30 | 17 | | |
31 | | - | |
32 | | - | |
| 18 | + | |
| 19 | + | |
33 | 20 | | |
34 | 21 | | |
35 | 22 | | |
36 | 23 | | |
37 | 24 | | |
38 | | - | |
| 25 | + | |
39 | 26 | | |
40 | 27 | | |
41 | 28 | | |
| |||
53 | 40 | | |
54 | 41 | | |
55 | 42 | | |
| 43 | + | |
| 44 | + | |
56 | 45 | | |
57 | 46 | | |
58 | 47 | | |
59 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
| 70 | + | |
62 | 71 | | |
63 | 72 | | |
64 | 73 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
2 | 9 | | |
3 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
4 | 23 | | |
5 | 24 | | |
6 | 25 | | |
7 | 26 | | |
8 | 27 | | |
9 | 28 | | |
10 | | - | |
| 29 | + | |
| 30 | + | |
11 | 31 | | |
12 | 32 | | |
13 | 33 | | |
| |||
70 | 90 | | |
71 | 91 | | |
72 | 92 | | |
73 | | - | |
74 | | - | |
75 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
76 | 107 | | |
77 | 108 | | |
78 | 109 | | |
| |||
433 | 464 | | |
434 | 465 | | |
435 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
436 | 470 | | |
437 | 471 | | |
438 | 472 | | |
| |||
452 | 486 | | |
453 | 487 | | |
454 | 488 | | |
455 | | - | |
| 489 | + | |
456 | 490 | | |
457 | | - | |
| 491 | + | |
458 | 492 | | |
459 | | - | |
| 493 | + | |
460 | 494 | | |
461 | 495 | | |
462 | 496 | | |
| |||
483 | 517 | | |
484 | 518 | | |
485 | 519 | | |
486 | | - | |
| 520 | + | |
487 | 521 | | |
488 | 522 | | |
489 | 523 | | |
| |||
598 | 632 | | |
599 | 633 | | |
600 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
601 | 664 | | |
602 | 665 | | |
603 | 666 | | |
| |||
839 | 902 | | |
840 | 903 | | |
841 | 904 | | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | 905 | | |
873 | 906 | | |
874 | 907 | | |
| |||
1050 | 1083 | | |
1051 | 1084 | | |
1052 | 1085 | | |
1053 | | - | |
| 1086 | + | |
1054 | 1087 | | |
1055 | 1088 | | |
1056 | 1089 | | |
| |||
1104 | 1137 | | |
1105 | 1138 | | |
1106 | 1139 | | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
0 commit comments