Refactor DB.checkpoint() to accept any mode.

This was originally meant to add a TRUNCATE checkpoint before starting
a new generation, however, there is a write lock that blocks the
checkpoint and it's more complicated to roll it back and attempt the
truncation.
This commit is contained in:
Ben Johnson
2020-12-29 17:02:33 -07:00
parent 42a33cccf4
commit d4891f33da
2 changed files with 33 additions and 18 deletions

View File

@@ -27,6 +27,14 @@ const (
GenerationNameLen = 16
)
// SQLite checkpoint modes.
const (
CheckpointModePassive = "PASSIVE"
CheckpointModeFull = "FULL"
CheckpointModeRestart = "RESTART"
CheckpointModeTruncate = "TRUNCATE"
)
// Litestream errors.
var (
ErrNoSnapshots = errors.New("no snapshots available")