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 ¶
- type Server
- func (s *Server) DeleteAll(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupDeleteAll) error
- func (s *Server) DeleteLTXFiles(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupDeleteLTXFiles) error
- func (s *Server) ListLTXFiles(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupListLTXFiles) error
- func (s *Server) OpenLTXFile(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupOpenLTXFile) error
- func (s *Server) WriteLTXFile(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupWriteLTXFile) error
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 (*Server) DeleteAll ¶
func (s *Server) DeleteAll(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupDeleteAll) error
DeleteAll discards every file held for a key.
func (*Server) DeleteLTXFiles ¶
func (s *Server) DeleteLTXFiles(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupDeleteLTXFiles) error
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 ¶
func (s *Server) ListLTXFiles(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupListLTXFiles) error
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 ¶
func (s *Server) OpenLTXFile(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupOpenLTXFile) error
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 ¶
func (s *Server) WriteLTXFile(ctx context.Context, state *sqlitebackup_v1alpha.SqliteBackupWriteLTXFile) error
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.