mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Add tool to see idx file contents
This commit is contained in:
parent
43689146cc
commit
add99ed57e
38
unmaintained/see_idx/see_idx.go
Normal file
38
unmaintained/see_idx/see_idx.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/chrislusf/weed-fs/go/glog"
|
||||
"github.com/chrislusf/weed-fs/go/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
fixVolumePath = flag.String("dir", "/tmp", "data directory to store files")
|
||||
fixVolumeCollection = flag.String("collection", "", "the volume collection name")
|
||||
fixVolumeId = flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir. The volume index file should not exist.")
|
||||
)
|
||||
|
||||
/*
|
||||
This is to see content in .idx files.
|
||||
|
||||
see_idx -v=4 -volumeId=9 -dir=/Users/chrislu/Downloads
|
||||
*/
|
||||
func main() {
|
||||
flag.Parse()
|
||||
fileName := strconv.Itoa(*fixVolumeId)
|
||||
if *fixVolumeCollection != "" {
|
||||
fileName = *fixVolumeCollection + "_" + fileName
|
||||
}
|
||||
indexFile, err := os.OpenFile(path.Join(*fixVolumePath, fileName+".idx"), os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
glog.Fatalf("Create Volume Index [ERROR] %s\n", err)
|
||||
}
|
||||
defer indexFile.Close()
|
||||
|
||||
storage.LoadNeedleMap(indexFile)
|
||||
|
||||
}
|
Loading…
Reference in a new issue