tka: compact TKA storage on startup

Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
Tom DNetto
2023-03-01 14:14:35 -08:00
committed by Tom
parent e2d652ec4d
commit 88c7d19d54
6 changed files with 250 additions and 5 deletions

View File

@@ -720,3 +720,17 @@ func (a *Authority) Keys() []Key {
func (a *Authority) StateIDs() (uint64, uint64) {
return a.state.StateID1, a.state.StateID2
}
// Compact deletes historical AUMs based on the given compaction options.
func (a *Authority) Compact(storage CompactableChonk, o CompactionOptions) error {
newAncestor, err := Compact(storage, a.head.Hash(), o)
if err != nil {
return err
}
ancestor, err := storage.AUM(newAncestor)
if err != nil {
return err
}
a.oldestAncestor = ancestor
return nil
}