d4be9f6ff1
gates / gates (push) Failing after 14m0s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
18 lines
677 B
Go
18 lines
677 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// SnapshotInto writes a consistent, compacted copy of the whole database to path with SQLite's `VACUUM INTO`
|
|
// (R-173, hub v0.136.0). One statement inside one read transaction: it sees one point in time and includes every
|
|
// committed write still sitting in hub.db-wal — unlike copying hub.db (+ -wal) as files while the hub writes. The
|
|
// target must not exist. Pinned by internal/dbsnap (TestSnapshot_*).
|
|
func (s *Store) SnapshotInto(ctx context.Context, path string) error {
|
|
if _, err := s.db.ExecContext(ctx, `VACUUM INTO ?`, path); err != nil {
|
|
return fmt.Errorf("store: VACUUM INTO %s: %w", path, err)
|
|
}
|
|
return nil
|
|
}
|