@@ -6,22 +6,30 @@ It replaces the default SQLite VFS with a **pure Go** implementation,
6
6
and exposes [ interfaces] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs#VFS )
7
7
that should allow you to implement your own [ custom VFSes] ( #custom-vfses ) .
8
8
9
- Since it is a from scratch reimplementation,
9
+ See the [ support matrix] ( https://github.com/ncruces/go-sqlite3/wiki/Support-matrix )
10
+ for the list of supported OS and CPU architectures.
11
+
12
+ Since this is a from scratch reimplementation,
10
13
there are naturally some ways it deviates from the original.
14
+ It's also not as battle tested as the original.
11
15
12
- The main differences are [ file locking] ( #file-locking ) and [ WAL mode] ( #write-ahead-logging ) support.
16
+ The main differences to be aware of are
17
+ [ file locking] ( #file-locking ) and
18
+ [ WAL mode] ( #write-ahead-logging ) support.
13
19
14
20
### File Locking
15
21
16
- POSIX advisory locks, which SQLite uses on Unix, are
17
- [ broken by design] ( https://github.com/sqlite/sqlite/blob/b74eb0/src/os_unix.c#L1073-L1161 ) .
22
+ POSIX advisory locks,
23
+ which SQLite uses on [ Unix] ( https://github.com/sqlite/sqlite/blob/5d60f4/src/os_unix.c#L13-L14 ) ,
24
+ are [ broken by design] ( https://github.com/sqlite/sqlite/blob/5d60f4/src/os_unix.c#L1074-L1162 ) .
18
25
Instead, on Linux and macOS, this package uses
19
26
[ OFD locks] ( https://www.gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html )
20
27
to synchronize access to database files.
21
28
22
29
This package can also use
23
30
[ BSD locks] ( https://man.freebsd.org/cgi/man.cgi?query=flock&sektion=2 ) ,
24
- albeit with reduced concurrency (` BEGIN IMMEDIATE ` behaves like ` BEGIN EXCLUSIVE ` ).
31
+ albeit with reduced concurrency (` BEGIN IMMEDIATE ` behaves like ` BEGIN EXCLUSIVE ` ,
32
+ [ docs] ( https://sqlite.org/lang_transaction.html#immediate ) ).
25
33
BSD locks are the default on BSD and illumos,
26
34
but you can opt into them with the ` sqlite3_flock ` build tag.
27
35
@@ -44,11 +52,11 @@ to check if your build supports file locking.
44
52
45
53
### Write-Ahead Logging
46
54
47
- On Unix, this package may use ` mmap ` to implement
55
+ On Unix, this package uses ` mmap ` to implement
48
56
[ shared-memory for the WAL-index] ( https://sqlite.org/wal.html#implementation_of_shared_memory_for_the_wal_index ) ,
49
57
like SQLite.
50
58
51
- On Windows, this package may use ` MapViewOfFile ` , like SQLite.
59
+ On Windows, this package uses ` MapViewOfFile ` , like SQLite.
52
60
53
61
You can also opt into a cross-platform, in-process, memory sharing implementation
54
62
with the ` sqlite3_dotlk ` build tag.
@@ -63,6 +71,11 @@ you must disable connection pooling by calling
63
71
You can use [ ` vfs.SupportsSharedMemory ` ] ( https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs#SupportsSharedMemory )
64
72
to check if your build supports shared memory.
65
73
74
+ ### Blocking Locks
75
+
76
+ On Windows and macOS, this package implements
77
+ [ Wal-mode blocking locks] ( https://sqlite.org/src/doc/tip/doc/wal-lock.md ) .
78
+
66
79
### Batch-Atomic Write
67
80
68
81
On Linux, this package may support
@@ -94,8 +107,8 @@ The VFS can be customized with a few build tags:
94
107
> [ ` unix-flock ` VFS] ( https://sqlite.org/compile.html#enable_locking_style ) ;
95
108
> ` sqlite3_dotlk ` builds are compatible with the
96
109
> [ ` unix-dotfile ` VFS] ( https://sqlite.org/compile.html#enable_locking_style ) .
97
- > If incompatible file locking is used, accessing databases concurrently with
98
- > _ other _ SQLite libraries will eventually corrupt data.
110
+ > Accessing databases concurrently using incompatible implementations
111
+ > will eventually corrupt data.
99
112
100
113
### Custom VFSes
101
114
0 commit comments