Example #1
0
func repair(src string, dst string, opts *Options) {
	srcArch := archivist.MustConnect(src, &opts.ConnectOpts)
	dstArch := archivist.MustConnect(dst, &opts.ConnectOpts)
	opts.SetRange(srcArch)
	log.Printf("repairing %v -> %v\n", src, dst)
	e := archivist.Repair(srcArch, dstArch, &opts.CommandOpts)
	if e != nil {
		log.Fatal(e)
	}
}
Example #2
0
func scan(a string, opts *Options) {
	arch := archivist.MustConnect(a, &opts.ConnectOpts)
	opts.SetRange(arch)
	e1 := arch.Scan(&opts.CommandOpts)
	e2 := arch.ReportMissing(&opts.CommandOpts)
	e3 := arch.ReportInvalid(&opts.CommandOpts)
	if e1 != nil {
		log.Fatal(e1)
	}
	if e2 != nil {
		log.Fatal(e2)
	}
	if e3 != nil {
		log.Fatal(e3)
	}
}
Example #3
0
func status(a string, opts *Options) {
	arch := archivist.MustConnect(a, &opts.ConnectOpts)
	state, e := arch.GetRootHAS()
	if e != nil {
		log.Fatal(e)
	}
	buckets := state.Buckets()
	summ, nz := state.LevelSummary()
	fmt.Printf("\n")
	fmt.Printf("       Archive: %s\n", a)
	fmt.Printf("        Server: %s\n", state.Server)
	fmt.Printf(" CurrentLedger: %d (0x%8.8x)\n", state.CurrentLedger, state.CurrentLedger)
	fmt.Printf("CurrentBuckets: %s (%d nonzero levels)\n", summ, nz)
	fmt.Printf(" Newest bucket: %s\n", buckets[0])
	fmt.Printf("\n")
}