mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 14:39:24 +08:00
remote.cache remote.uncache supports all mounted directories
This commit is contained in:
@@ -54,27 +54,30 @@ func (c *commandRemoteUncache) Do(args []string, commandEnv *CommandEnv, writer
|
||||
if listErr != nil {
|
||||
return listErr
|
||||
}
|
||||
if *dir == "" {
|
||||
jsonPrintln(writer, mappings)
|
||||
fmt.Fprintln(writer, "need to specify '-dir' option")
|
||||
return nil
|
||||
}
|
||||
|
||||
var localMountedDir string
|
||||
for k := range mappings.Mappings {
|
||||
if strings.HasPrefix(*dir, k) {
|
||||
localMountedDir = k
|
||||
if *dir != "" {
|
||||
var localMountedDir string
|
||||
for k := range mappings.Mappings {
|
||||
if strings.HasPrefix(*dir, k) {
|
||||
localMountedDir = k
|
||||
}
|
||||
}
|
||||
if localMountedDir == "" {
|
||||
jsonPrintln(writer, mappings)
|
||||
fmt.Fprintf(writer, "%s is not mounted\n", *dir)
|
||||
return nil
|
||||
}
|
||||
|
||||
// pull content from remote
|
||||
if err = c.uncacheContentData(commandEnv, writer, util.FullPath(*dir), fileFiler); err != nil {
|
||||
return fmt.Errorf("uncache content data: %v", err)
|
||||
}
|
||||
}
|
||||
if localMountedDir == "" {
|
||||
jsonPrintln(writer, mappings)
|
||||
fmt.Fprintf(writer, "%s is not mounted\n", *dir)
|
||||
return nil
|
||||
}
|
||||
|
||||
// pull content from remote
|
||||
if err = c.uncacheContentData(commandEnv, writer, util.FullPath(*dir), fileFiler); err != nil {
|
||||
return fmt.Errorf("uncache content data: %v", err)
|
||||
for key, _ := range mappings.Mappings {
|
||||
if err := c.uncacheContentData(commandEnv, writer, util.FullPath(key), fileFiler); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user