sqlitebackup

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package sqlitebackup stores the LTX transaction files that runners replicate from SQLite-provider disks. It is the coordinator half of the replication loop: runners drive it through a litestream ReplicaClient in components/sqlitedisk.

The on-disk layout deliberately matches litestream's own file replica client (<root>/<key>/level-<n>/<minTXID>-<maxTXID>.ltx, with each file's mtime set to the transaction timestamp from its LTX header) so the two can be compared directly when diagnosing replication problems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements the SqliteBackup RPC interface over a directory tree.

func NewServer

func NewServer(log *slog.Logger, root string) (*Server, error)

NewServer returns a Server storing backups beneath root, creating it if needed.

func (*Server) DeleteAll

DeleteAll discards every file held for a key.

func (*Server) DeleteLTXFiles

DeleteLTXFiles removes specific files. Files that are already gone are not an error: litestream retries retention passes, and a partially-applied delete must be able to complete on the next attempt.

func (*Server) ListLTXFiles

ListLTXFiles reports the files held at a level, ordered by transaction ID. A level that has never been written is reported as empty rather than missing, matching how litestream's file client treats an absent directory.

func (*Server) OpenLTXFile

OpenLTXFile streams one file back to the caller. A size of 0 means read to the end; offset and size together let litestream resume a partial read.

func (*Server) WriteLTXFile

WriteLTXFile stores a file, replacing any existing file with the same transaction range. The write lands on a temp file and is fsynced before being renamed into place, so a crash mid-transfer cannot leave a torn file that ListLTXFiles would report as complete.

Jump to

Keyboard shortcuts

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