vfs package - github.com/ncruces/go-sqlite3/vfs - Go Packages (original) (raw)
Package vfs wraps the C SQLite VFS API.
- Constants
- func ExportHostFunctions(env wazero.HostModuleBuilder) wazero.HostModuleBuilder
- func Register(name string, vfs VFS)
- func SystemError[T interface{ ... }](err error, code T) error
- func Unregister(name string)
- type AccessFlag
- type DeviceCharacteristic
- type File
- type FileBatchAtomicWrite
- type FileBusyHandler
- type FileCheckpoint
- type FileChunkSize
- type FileCommitPhaseTwo
- type FileHasMoved
- type FileLockState
- type FileOverwrite
- type FilePersistWAL
- type FilePowersafeOverwrite
- type FilePragma
- type FileSharedMemory
- type FileSizeHint
- type FileSync
- type FileUnwrap
- type Filename
- type LockLevel
- type OpenFlag
- type SharedMemory
- type SyncFlag
- type VFS
- type VFSFilename
SupportsFileLocking is false on platforms that do not support file locking. To open a database file on those platforms, you need to use the nolock or immutable URI parameters.
SupportsSharedMemory is false on platforms that do not support shared memory. To use WAL without shared-memory, you need to set EXCLUSIVE locking mode.
This section is empty.
ExportHostFunctions is an internal API users need not call directly.
ExportHostFunctions registers the required VFS host functions with the provided env module.
SystemError tags an error with a given sqlite3.ErrorCode or sqlite3.ExtendedErrorCode.
type DeviceCharacteristic uint32
DeviceCharacteristic is a flag retuned by the File DeviceCharacteristics method.
https://sqlite.org/c3ref/c_iocap_atomic.html
const ( IOCAP_ATOMIC DeviceCharacteristic = 0x00000001 IOCAP_ATOMIC512 DeviceCharacteristic = 0x00000002 IOCAP_ATOMIC1K DeviceCharacteristic = 0x00000004 IOCAP_ATOMIC2K DeviceCharacteristic = 0x00000008 IOCAP_ATOMIC4K DeviceCharacteristic = 0x00000010 IOCAP_ATOMIC8K DeviceCharacteristic = 0x00000020 IOCAP_ATOMIC16K DeviceCharacteristic = 0x00000040 IOCAP_ATOMIC32K DeviceCharacteristic = 0x00000080 IOCAP_ATOMIC64K DeviceCharacteristic = 0x00000100 IOCAP_SAFE_APPEND DeviceCharacteristic = 0x00000200 IOCAP_SEQUENTIAL DeviceCharacteristic = 0x00000400 IOCAP_UNDELETABLE_WHEN_OPEN DeviceCharacteristic = 0x00000800 IOCAP_POWERSAFE_OVERWRITE DeviceCharacteristic = 0x00001000 IOCAP_IMMUTABLE DeviceCharacteristic = 0x00002000 IOCAP_BATCH_ATOMIC DeviceCharacteristic = 0x00004000 IOCAP_SUBPAGE_READ DeviceCharacteristic = 0x00008000 )
A File represents an open file in the OS interface layer.
Use SystemError, sqlite3.ErrorCode, or sqlite3.ExtendedErrorCode to return specific error codes to SQLite. In particular, sqlite3.BUSY is needed to correctly implement lock methods.
https://sqlite.org/c3ref/io_methods.html
type FileSharedMemory interface { File SharedMemory() SharedMemory }
FileSharedMemory extends File to possibly implement shared-memory for the WAL-index. The same shared-memory instance must be returned for the entire life of the file. It's OK for SharedMemory to return nil.
type FileUnwrap interface { File Unwrap() File }
FileUnwrap should be implemented by a File that wraps another File implementation.
Filename is used by SQLite to pass filenames to the Open method of a VFS.
https://sqlite.org/c3ref/filename.html
GetFilename is an internal API users should not call directly.
String returns this filename as a string.
OpenFlag is a flag for the VFS Open method.
https://sqlite.org/c3ref/c_open_autoproxy.html
const ( OPEN_READONLY OpenFlag = 0x00000001 OPEN_READWRITE OpenFlag = 0x00000002 OPEN_CREATE OpenFlag = 0x00000004 OPEN_DELETEONCLOSE OpenFlag = 0x00000008 OPEN_EXCLUSIVE OpenFlag = 0x00000010 OPEN_AUTOPROXY OpenFlag = 0x00000020 OPEN_URI OpenFlag = 0x00000040 OPEN_MEMORY OpenFlag = 0x00000080 OPEN_MAIN_DB OpenFlag = 0x00000100 OPEN_TEMP_DB OpenFlag = 0x00000200 OPEN_TRANSIENT_DB OpenFlag = 0x00000400 OPEN_MAIN_JOURNAL OpenFlag = 0x00000800 OPEN_TEMP_JOURNAL OpenFlag = 0x00001000 OPEN_SUBJOURNAL OpenFlag = 0x00002000 OPEN_SUPER_JOURNAL OpenFlag = 0x00004000 OPEN_NOMUTEX OpenFlag = 0x00008000 OPEN_FULLMUTEX OpenFlag = 0x00010000 OPEN_SHAREDCACHE OpenFlag = 0x00020000 OPEN_PRIVATECACHE OpenFlag = 0x00040000 OPEN_WAL OpenFlag = 0x00080000 OPEN_NOFOLLOW OpenFlag = 0x01000000
)
type SharedMemory interface { io.Closer
}
SharedMemory is a shared-memory WAL-index implementation. Use NewSharedMemory to create a shared-memory.
func NewSharedMemory(path string, flags OpenFlag) SharedMemory
NewSharedMemory returns a shared-memory WAL-index backed by a file with the given path. It will return nil if shared-memory is not supported, or not appropriate for the given flags. Only OPEN_MAIN_DB databases may need a WAL-index. You must ensure all concurrent accesses to a database use shared-memory instances created with the same path.
A VFS defines the interface between the SQLite core and the underlying operating system.
Use SystemError, sqlite3.ErrorCode, or sqlite3.ExtendedErrorCode to return specific error codes to SQLite.