aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_copy.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-06-10 16:57:32 -0700
committerChris Lu <chris.lu@gmail.com>2018-06-10 16:57:32 -0700
commit98110c16970a1c231a5cc04e0eb85ec48d649e14 (patch)
tree17dceb7f2426cc857e64881091c3993c34c51494 /weed/command/filer_copy.go
parentf1273073fc1b3d5c62ccb734b84e12fa3053d65f (diff)
downloadseaweedfs-98110c16970a1c231a5cc04e0eb85ec48d649e14.tar.xz
seaweedfs-98110c16970a1c231a5cc04e0eb85ec48d649e14.zip
add collection, replication, ttl to each file
Diffstat (limited to 'weed/command/filer_copy.go')
-rw-r--r--weed/command/filer_copy.go35
1 files changed, 21 insertions, 14 deletions
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go
index 6bc3d4119..3d4e5db9f 100644
--- a/weed/command/filer_copy.go
+++ b/weed/command/filer_copy.go
@@ -18,6 +18,7 @@ import (
"time"
"google.golang.org/grpc"
"context"
+ "github.com/chrislusf/seaweedfs/weed/util"
)
var (
@@ -212,13 +213,16 @@ func uploadFileAsOne(filerAddress, filerGrpcAddress string, urlFolder string, f
Entry: &filer_pb.Entry{
Name: fileName,
Attributes: &filer_pb.FuseAttributes{
- Crtime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Gid: uint32(os.Getgid()),
- Uid: uint32(os.Getuid()),
- FileSize: uint64(fi.Size()),
- FileMode: uint32(fi.Mode()),
- Mime: mimeType,
+ Crtime: time.Now().Unix(),
+ Mtime: time.Now().Unix(),
+ Gid: uint32(os.Getgid()),
+ Uid: uint32(os.Getuid()),
+ FileSize: uint64(fi.Size()),
+ FileMode: uint32(fi.Mode()),
+ Mime: mimeType,
+ Replication: *copy.replication,
+ Collection: *copy.collection,
+ TtlSec: int32(util.ParseInt(*copy.ttl, 0)),
},
Chunks: chunks,
},
@@ -285,13 +289,16 @@ func uploadFileInChunks(filerAddress, filerGrpcAddress string, urlFolder string,
Entry: &filer_pb.Entry{
Name: fileName,
Attributes: &filer_pb.FuseAttributes{
- Crtime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Gid: uint32(os.Getgid()),
- Uid: uint32(os.Getuid()),
- FileSize: uint64(fi.Size()),
- FileMode: uint32(fi.Mode()),
- Mime: mimeType,
+ Crtime: time.Now().Unix(),
+ Mtime: time.Now().Unix(),
+ Gid: uint32(os.Getgid()),
+ Uid: uint32(os.Getuid()),
+ FileSize: uint64(fi.Size()),
+ FileMode: uint32(fi.Mode()),
+ Mime: mimeType,
+ Replication: *copy.replication,
+ Collection: *copy.collection,
+ TtlSec: int32(util.ParseInt(*copy.ttl, 0)),
},
Chunks: chunks,
},