Fix compilation error!!!

This commit is contained in:
chrislusf 2015-06-02 00:23:41 -07:00
parent 51aac49e82
commit 26cdd11d8f

View file

@ -45,12 +45,13 @@ func init() {
export.dir = cmdExport.Flag.String("dir", ".", "input data directory to store volume data files") export.dir = cmdExport.Flag.String("dir", ".", "input data directory to store volume data files")
export.collection = cmdExport.Flag.String("collection", "", "the volume collection name") export.collection = cmdExport.Flag.String("collection", "", "the volume collection name")
export.volumeId = cmdExport.Flag.Int("volumeId", -1, "a volume id. The volume .dat and .idx files should already exist in the dir.") export.volumeId = cmdExport.Flag.Int("volumeId", -1, "a volume id. The volume .dat and .idx files should already exist in the dir.")
dest = cmdExport.Flag.String("o", "", "output tar file name, must ends with .tar, or just a \"-\" for stdout")
format = cmdExport.Flag.String("fileNameFormat", defaultFnFormat, "filename format, default to {{.Mime}}/{{.Id}}:{{.Name}}")
newer = cmdExport.Flag.String("newer", "", "export only files newer than this time, default is all files. Must be specified in RFC3339 without timezone")
} }
var ( var (
dest = cmdExport.Flag.String("o", "", "output tar file name, must ends with .tar, or just a \"-\" for stdout")
format = cmdExport.Flag.String("fileNameFormat", defaultFnFormat, "filename format, default to {{.Mime}}/{{.Id}}:{{.Name}}")
newer = cmdExport.Flag.String("newer", "", "export only files newer than this time, default is all files. Must be specified in RFC3339 without timezone")
tarFh *tar.Writer tarFh *tar.Writer
tarHeader tar.Header tarHeader tar.Header
fnTmpl *template.Template fnTmpl *template.Template
@ -72,7 +73,7 @@ func runExport(cmd *Command, args []string) bool {
newerThanUnix = newerThan.Unix() newerThanUnix = newerThan.Unix()
} }
if *exportVolumeId == -1 { if *export.volumeId == -1 {
return false return false
} }
@ -105,12 +106,12 @@ func runExport(cmd *Command, args []string) bool {
AccessTime: t, ChangeTime: t} AccessTime: t, ChangeTime: t}
} }
fileName := strconv.Itoa(*exportVolumeId) fileName := strconv.Itoa(*export.volumeId)
if *exportCollection != "" { if *export.collection != "" {
fileName = *exportCollection + "_" + fileName fileName = *export.collection + "_" + fileName
} }
vid := storage.VolumeId(*exportVolumeId) vid := storage.VolumeId(*export.volumeId)
indexFile, err := os.OpenFile(path.Join(*exportVolumePath, fileName+".idx"), os.O_RDONLY, 0644) indexFile, err := os.OpenFile(path.Join(*export.dir, fileName+".idx"), os.O_RDONLY, 0644)
if err != nil { if err != nil {
glog.Fatalf("Create Volume Index [ERROR] %s\n", err) glog.Fatalf("Create Volume Index [ERROR] %s\n", err)
} }
@ -123,7 +124,7 @@ func runExport(cmd *Command, args []string) bool {
var version storage.Version var version storage.Version
err = storage.ScanVolumeFile(*exportVolumePath, *exportCollection, vid, err = storage.ScanVolumeFile(*export.dir, *export.collection, vid,
storage.NeedleMapInMemory, storage.NeedleMapInMemory,
func(superBlock storage.SuperBlock) error { func(superBlock storage.SuperBlock) error {
version = superBlock.Version() version = superBlock.Version()