Documentation
¶
Overview ¶
Package spool implements a WAL pooler keeping track of which WALs we have archived
Index ¶
- Variables
- type WALSpool
- func (spool *WALSpool) CleanupTemp(walName string)
- func (spool *WALSpool) Commit(walName string) error
- func (spool *WALSpool) Contains(walFile string) (bool, error)
- func (spool *WALSpool) FileName(walName string) string
- func (spool *WALSpool) MoveOut(walName, destination string) (err error)
- func (spool *WALSpool) Remove(walFile string) error
- func (spool *WALSpool) TempFileName(walName string) string
- func (spool *WALSpool) Touch(walFile string) (err error)
Constants ¶
This section is empty.
Variables ¶
var ErrorNonExistentFile = fs.ErrNotExist
ErrorNonExistentFile is returned when the spool tried to work on a file which doesn't exist
Functions ¶
This section is empty.
Types ¶
type WALSpool ¶
type WALSpool struct {
// contains filtered or unexported fields
}
WALSpool is a way to keep track of which WAL files were processes from the parallel feature and not by PostgreSQL request. It works using a directory, under which we create an empty file carrying the name of the WAL we archived
func (*WALSpool) CleanupTemp ¶ added in v0.5.0
CleanupTemp removes a temporary file if it exists. This should be called when a download fails to avoid leaving partial files.
func (*WALSpool) Commit ¶ added in v0.5.0
Commit atomically moves a completed download from its temp path to the final path. This should be called after a successful download to make the file visible to MoveOut. The rename is atomic on POSIX systems when both paths are on the same filesystem.
func (*WALSpool) Remove ¶
Remove removes a WAL file from the spool. If the WAL file doesn't exist an error is returned
func (*WALSpool) TempFileName ¶ added in v0.5.0
TempFileName gets the temporary file path for a WAL being downloaded. Files should be written here first, then committed with Commit() to ensure atomic visibility to MoveOut and Contains.