gotosocial/vendor/github.com/ncruces/go-sqlite3/vfs
Daenney 9ae0c7b363
[chore] Update ncruces/go-sqlite3 to 0.21.3 (#3629)
This includes some additional locking fixes for the BSDs.
2024-12-20 21:37:19 +00:00
..
memdb bump ncruces/go-sqlite3 to v0.20.2 (#3524) 2024-11-07 00:16:28 +00:00
api.go update go-sqlite3 => v0.20.0 (#3483) 2024-10-25 16:09:18 +00:00
cksm.go pull in ncruces/go-sqlite3 v0.20.3 with tetratelabs/wazero v1.8.2 (#3574) 2024-11-26 16:25:48 +00:00
const.go pull in ncruces/go-sqlite3 v0.20.3 with tetratelabs/wazero v1.8.2 (#3574) 2024-11-26 16:25:48 +00:00
file.go pull in ncruces/go-sqlite3 v0.20.3 with tetratelabs/wazero v1.8.2 (#3574) 2024-11-26 16:25:48 +00:00
filename.go update go-sqlite3 => v0.20.0 (#3483) 2024-10-25 16:09:18 +00:00
lock.go [chore] Update ncruces/go-sqlite3 to 0.21.3 (#3629) 2024-12-20 21:37:19 +00:00
lock_other.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_bsd.go update ncruces/go-sqlite3 to v0.21.2 (#3626) 2024-12-17 23:16:20 +00:00
os_darwin.go bump ncruces/go-sqlite3 to v0.21.1 (#3625) 2024-12-16 11:37:53 +00:00
os_dotlk.go update ncruces/go-sqlite3 to v0.21.2 (#3626) 2024-12-17 23:16:20 +00:00
os_f2fs_linux.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_linux.go bump ncruces/go-sqlite3 to v0.21.1 (#3625) 2024-12-16 11:37:53 +00:00
os_ofd.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_std.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_std_alloc.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_std_atomic.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_std_sync.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_unix.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
os_windows.go bump ncruces/go-sqlite3 to v0.21.1 (#3625) 2024-12-16 11:37:53 +00:00
README.md update ncruces/go-sqlite3 to v0.21.2 (#3626) 2024-12-17 23:16:20 +00:00
registry.go [experiment] add alternative wasm sqlite3 implementation available via build-tag (#2863) 2024-05-27 17:46:15 +02:00
shm.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
shm_bsd.go [chore] Update ncruces/go-sqlite3 to 0.21.3 (#3629) 2024-12-20 21:37:19 +00:00
shm_copy.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
shm_dotlk.go [chore] Update ncruces/go-sqlite3 to 0.21.3 (#3629) 2024-12-20 21:37:19 +00:00
shm_memlk.go [chore] Update ncruces/go-sqlite3 to 0.21.3 (#3629) 2024-12-20 21:37:19 +00:00
shm_ofd.go [chore] Update ncruces/go-sqlite3 to 0.21.3 (#3629) 2024-12-20 21:37:19 +00:00
shm_other.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
shm_windows.go bump ncruces/go-sqlite3 to v0.21.0 (#3621) 2024-12-12 19:44:53 +00:00
vfs.go update go-sqlite3 => v0.20.0 (#3483) 2024-10-25 16:09:18 +00:00

Go SQLite VFS API

This package implements the SQLite OS Interface (aka VFS).

It replaces the default SQLite VFS with a pure Go implementation, and exposes interfaces that should allow you to implement your own custom VFSes.

Since it is a from scratch reimplementation, there are naturally some ways it deviates from the original.

The main differences are file locking and WAL mode support.

File Locking

POSIX advisory locks, which SQLite uses on Unix, are broken by design. Instead, on Linux and macOS, this package uses OFD locks to synchronize access to database files.

This package can also use BSD locks, albeit with reduced concurrency (BEGIN IMMEDIATE behaves like BEGIN EXCLUSIVE). BSD locks are the default on BSD and illumos, but you can opt into them with the sqlite3_flock build tag.

On Windows, this package uses LockFileEx and UnlockFileEx, like SQLite.

You can also opt into a cross-platform locking implementation with the sqlite3_dotlk build tag.

Otherwise, file locking is not supported, and you must use nolock=1 (or immutable=1) to open database files. To use the database/sql driver with nolock=1 you must disable connection pooling by calling db.SetMaxOpenConns(1).

You can use vfs.SupportsFileLocking to check if your build supports file locking.

Write-Ahead Logging

On Unix, this package may use mmap to implement shared-memory for the WAL-index, like SQLite.

On Windows, this package may use MapViewOfFile, like SQLite.

You can also opt into a cross-platform, in-process, memory sharing implementation with the sqlite3_dotlk build tag.

Otherwise, WAL support is limited, and EXCLUSIVE locking mode must be set to create, read, and write WAL databases. To use EXCLUSIVE locking mode with the database/sql driver you must disable connection pooling by calling db.SetMaxOpenConns(1).

You can use vfs.SupportsSharedMemory to check if your build supports shared memory.

Batch-Atomic Write

On Linux, this package may support batch-atomic writes on the F2FS filesystem.

Checksums

This package can be configured to add an 8-byte checksum to the end of every page in an SQLite database. The checksum is added as each page is written and verified as each page is read.
The checksum is intended to help detect database corruption caused by random bit-flips in the mass storage device.

The implementation is compatible with SQLite's Checksum VFS Shim.

Build Tags

The VFS can be customized with a few build tags:

  • sqlite3_flock forces the use of BSD locks.
  • sqlite3_dotlk forces the use of dot-file locks.

Important

The default configuration of this package is compatible with the standard Unix and Windows SQLite VFSes; sqlite3_flock builds are compatible with the unix-flock VFS; sqlite3_dotlk builds are compatible with the unix-dotfile VFS. If incompatible file locking is used, accessing databases concurrently with other SQLite libraries will eventually corrupt data.

Custom VFSes