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
[sync] override amz storage class, None to delete (#3639)
Konstantin Lebedevb64674018a61
diff --git a/weed/command/filer_remote_sync.go b/weed/command/filer_remote_sync.goindex 84d2f0e916..f1b5ef01dc 100644--- a/weed/command/filer_remote_sync.go+++ b/weed/command/filer_remote_sync.go@@ -14,6 +14,7 @@ import (type RemoteSyncOptions struct {filerAddress *string+ storageClass *stringgrpcDialOption grpc.DialOptionreadChunkFromFiler *booltimeAgo *time.Duration@@ -45,6 +46,7 @@ func init() {cmdFilerRemoteSynchronize.Run = runFilerRemoteSynchronize // break init cycleremoteSyncOptions.filerAddress = cmdFilerRemoteSynchronize.Flag.String("filer", "localhost:8888", "filer of the SeaweedFS cluster")remoteSyncOptions.dir = cmdFilerRemoteSynchronize.Flag.String("dir", "", "a mounted directory on filer")+ remoteSyncOptions.storageClass = cmdFilerRemoteSynchronize.Flag.String("storageClass", "None", "override amz storage class, empty to delete")remoteSyncOptions.readChunkFromFiler = cmdFilerRemoteSynchronize.Flag.Bool("filerProxy", false, "read file chunks from filer instead of volume servers")remoteSyncOptions.timeAgo = cmdFilerRemoteSynchronize.Flag.Duration("timeAgo", 0, "start time before now, skipping previous metadata changes. \"300ms\", \"1.5h\" or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\"")remoteSyncOptions.clientId = util.RandomInt32()diff --git a/weed/command/filer_remote_sync_dir.go b/weed/command/filer_remote_sync_dir.goindex 6f061bda89..288b89a5a3 100644--- a/weed/command/filer_remote_sync_dir.go+++ b/weed/command/filer_remote_sync_dir.go@@ -37,6 +37,12 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sourvar lastLogTsNs = time.Now().UnixNano()processEventFnWithOffset := pb.AddOffsetFunc(func(resp *filer_pb.SubscribeMetadataResponse) error {+ storageClass := *option.storageClass+ if storageClass == "" {+ delete(resp.EventNotification.NewEntry.Extended, s3_constants.AmzStorageClass)+ } else if storageClass != "None" {+ resp.EventNotification.NewEntry.Extended[s3_constants.AmzStorageClass] = []byte(storageClass)+ }processor.AddSyncJob(resp)return nil}, 3*time.Second, func(counter int64, lastTsNs int64) error {diff --git a/weed/command/filer_sync_jobs.go b/weed/command/filer_sync_jobs.goindex 50428a3ad3..9d2ba75d59 100644--- a/weed/command/filer_sync_jobs.go+++ b/weed/command/filer_sync_jobs.go@@ -54,7 +54,7 @@ func (t *MetadataProcessor) AddSyncJob(resp *filer_pb.SubscribeMetadataResponse)// if is the oldest job, write down the watermarkisOldest := true- for t, _ := range t.activeJobs {+ for t := range t.activeJobs {if resp.TsNs > t {isOldest = falsebreak