diff options
| author | chrislu <chris.lu@gmail.com> | 2025-08-30 11:18:03 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-08-30 11:18:03 -0700 |
| commit | 87021a146027f83f911619f71b9c27bd51e9d55a (patch) | |
| tree | c7720f1c285683ce19d28931bd7c11b5475a2844 /weed/shell/command_ec_common.go | |
| parent | 0748214c8e2f497a84b9392d2d7d4ec976bc84eb (diff) | |
| parent | 879d512b552d834136cfb746a239e6168e5c4ffb (diff) | |
| download | seaweedfs-origin/add-ec-vacuum.tar.xz seaweedfs-origin/add-ec-vacuum.zip | |
Merge branch 'master' into add-ec-vacuumorigin/add-ec-vacuum
Diffstat (limited to 'weed/shell/command_ec_common.go')
| -rw-r--r-- | weed/shell/command_ec_common.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.go index 04aeea208..ef2e08933 100644 --- a/weed/shell/command_ec_common.go +++ b/weed/shell/command_ec_common.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "math/rand/v2" + "regexp" "slices" "sort" "time" @@ -1058,3 +1059,13 @@ func EcBalance(commandEnv *CommandEnv, collections []string, dc string, ecReplic return nil } + +// compileCollectionPattern compiles a regex pattern for collection matching. +// Empty patterns match empty collections only. +func compileCollectionPattern(pattern string) (*regexp.Regexp, error) { + if pattern == "" { + // empty pattern matches empty collection + return regexp.Compile("^$") + } + return regexp.Compile(pattern) +} |
