SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
File Path Configuration TTL Validation (#4376)
Matt2d213d87e1c3
diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.goindex 60edb79c25..d09ea08823 100644--- a/weed/shell/command_fs_configure.go+++ b/weed/shell/command_fs_configure.go@@ -5,6 +5,7 @@ import ("flag""fmt""io"+ "regexp""strings""github.com/seaweedfs/seaweedfs/weed/filer"@@ -51,7 +52,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer iolocationPrefix := fsConfigureCommand.String("locationPrefix", "", "path prefix, required to update the path-specific configuration")collection := fsConfigureCommand.String("collection", "", "assign writes to this collection")replication := fsConfigureCommand.String("replication", "", "assign writes with this replication")- ttl := fsConfigureCommand.String("ttl", "", "assign writes with this ttl")+ ttl := fsConfigureCommand.String("ttl", "", "assign writes with this ttl (e.g., 1m, 1h, 1d, 1w, 1y)")diskType := fsConfigureCommand.String("disk", "", "[hdd|ssd|<tag>] hard drive or solid state drive or any tag")fsync := fsConfigureCommand.Bool("fsync", false, "fsync for the writes")isReadOnly := fsConfigureCommand.Bool("readOnly", false, "disable writes")@@ -102,6 +103,16 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io}}+ // check ttl+ if *ttl != "" {+ regex := "^[1-9][0-9]*[mhdwMy]$"+ match, _ := regexp.MatchString(regex, *ttl)++ if !match {+ return fmt.Errorf("ttl should be of the following format (e.g., 1m, 1h, 1d, 1w, 1y)")+ }+ }+// save itif *isDelete {fc.DeleteLocationConf(*locationPrefix)