mirror of
https://github.com/kopia/kopia.git
synced 2026-01-26 07:18:02 -05:00
26 lines
589 B
Go
26 lines
589 B
Go
package cli
|
|
|
|
import (
|
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
|
)
|
|
|
|
var (
|
|
blockRepackCommand = blockCommands.Command("repack", "Repackage small blocks into bigger ones")
|
|
blockRepackSizeThreshold = blockRepackCommand.Flag("max-size", "Max size of block to re-pack").Default("500000").Uint64()
|
|
)
|
|
|
|
func runBlockRepackAction(context *kingpin.ParseContext) error {
|
|
rep := mustOpenRepository(nil)
|
|
defer rep.Close()
|
|
|
|
if err := rep.Blocks.Repackage(*blockRepackSizeThreshold); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
blockRepackCommand.Action(runBlockRepackAction)
|
|
}
|