Browse Source

nit

pull/4038/head
root 2 years ago
parent
commit
b4477fae9c
  1. 5
      weed/filer/leveldb/leveldb_store.go
  2. 29
      weed/shell/command_fs_meta_snapshots_create.go

5
weed/filer/leveldb/leveldb_store.go

@ -43,11 +43,6 @@ func (store *LevelDBStore) Initialize(configuration weed_util.Configuration, pre
return store.initialize(dir) return store.initialize(dir)
} }
// For adhoc usage
func (store *LevelDBStore) CustomInitialize(dir string) (err error) {
return store.initialize(dir)
}
func (store *LevelDBStore) initialize(dir string) (err error) { func (store *LevelDBStore) initialize(dir string) (err error) {
glog.Infof("filer store dir: %s", dir) glog.Infof("filer store dir: %s", dir)
os.MkdirAll(dir, 0755) os.MkdirAll(dir, 0755)

29
weed/shell/command_fs_meta_snapshots_create.go

@ -30,6 +30,30 @@ func (c *commandFsMetaSnapshotsCreate) Name() string {
return "fs.meta.snapshots.create" return "fs.meta.snapshots.create"
} }
type SnapshotConfig struct {
dir string
}
func (c SnapshotConfig) GetString(key string) string {
return c.dir
}
func (c SnapshotConfig) GetBool(key string) bool {
panic("implement me")
}
func (c SnapshotConfig) GetInt(key string) int {
panic("implement me")
}
func (c SnapshotConfig) GetStringSlice(key string) []string {
panic("implement me")
}
func (c SnapshotConfig) SetDefault(key string, value interface{}) {
panic("implement me")
}
func (c *commandFsMetaSnapshotsCreate) Help() string { func (c *commandFsMetaSnapshotsCreate) Help() string {
return `create snapshots of meta data from given time range. return `create snapshots of meta data from given time range.
@ -179,7 +203,10 @@ func (c *commandFsMetaSnapshotsCreate) Do(args []string, commandEnv *CommandEnv,
return err return err
} }
store := &filer_leveldb.LevelDBStore{} store := &filer_leveldb.LevelDBStore{}
store.CustomInitialize(levelDbPath)
config := SnapshotConfig{
dir: levelDbPath,
}
store.Initialize(config, "")
changeLogPath := filer.SystemLogDir changeLogPath := filer.SystemLogDir
var processEntry func(entry *filer_pb.Entry, isLast bool) error var processEntry func(entry *filer_pb.Entry, isLast bool) error
processEntry = func(entry *filer_pb.Entry, isLast bool) error { processEntry = func(entry *filer_pb.Entry, isLast bool) error {

Loading…
Cancel
Save