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.

38 lines
958 B

  1. package main
  2. import (
  3. "flag"
  4. "os"
  5. "path"
  6. "strconv"
  7. "github.com/chrislusf/seaweedfs/go/glog"
  8. "github.com/chrislusf/seaweedfs/go/storage"
  9. )
  10. var (
  11. fixVolumePath = flag.String("dir", "/tmp", "data directory to store files")
  12. fixVolumeCollection = flag.String("collection", "", "the volume collection name")
  13. fixVolumeId = flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir. The volume index file should not exist.")
  14. )
  15. /*
  16. This is to see content in .idx files.
  17. see_idx -v=4 -volumeId=9 -dir=/Users/chrislu/Downloads
  18. */
  19. func main() {
  20. flag.Parse()
  21. fileName := strconv.Itoa(*fixVolumeId)
  22. if *fixVolumeCollection != "" {
  23. fileName = *fixVolumeCollection + "_" + fileName
  24. }
  25. indexFile, err := os.OpenFile(path.Join(*fixVolumePath, fileName+".idx"), os.O_RDONLY, 0644)
  26. if err != nil {
  27. glog.Fatalf("Create Volume Index [ERROR] %s\n", err)
  28. }
  29. defer indexFile.Close()
  30. storage.LoadNeedleMap(indexFile)
  31. }