replhook

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package replhook gives the replicator (replica/internal/capture) what it needs of the driver and the driver does not offer its users. Package sqlite fills it in as it is initialized.

Index

Constants

This section is empty.

Variables

View Source
var Attach func(path string, committed func(frames uint32)) (detach func(), err error)

Attach makes every connection the driver opens to the database file path from then on ready for replication: no automatic checkpoints, and the PRAGMAs that would checkpoint refused (csqlite.Conn.SetGuard). The file must exist. It is found by what it is, so a connection that names it another way (case, a short windows name) is covered too. It fails when the driver has a connection to the file open, or the file is attached already. detach ends it: connections opened after it are as before.

committed, if not nil, is called each time a connection of the driver that held the file's write lock ends its transaction, before the lock goes to the next writer, with the frames in the WAL as that connection last saw them (csqlite.Conn.WALFrames): after a commit, the WAL it left. It runs on the writer's goroutine and holds the lock meanwhile: the writers of the file wait for it, and it must not take the lock (Lock).

View Source
var Lock func(ctx context.Context, path string) (unlock func(), err error)

Lock takes the driver's write lock of an attached file, as a writer does, waiting until ctx is done: until unlock, no connection of this process writes to the file.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL