You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
561 B

  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "log"
  6. "os"
  7. "github.com/chrislusf/weed-fs/go/storage"
  8. )
  9. var (
  10. indexFileName = flag.String("file", "", ".idx file to analyze")
  11. )
  12. func main() {
  13. flag.Parse()
  14. indexFile, err := os.OpenFile(*indexFileName, os.O_RDONLY, 0644)
  15. if err != nil {
  16. log.Fatalf("Create Volume Index [ERROR] %s\n", err)
  17. }
  18. defer indexFile.Close()
  19. storage.WalkIndexFile(indexFile, func(key uint64, offset, size uint32) error {
  20. fmt.Printf("key %d, offset %d, size %d, nextOffset %d\n", key, offset*8, size, offset*8+size)
  21. return nil
  22. })
  23. }