Browse Source

adding modified time to file chunk

pull/664/head
Chris Lu 7 years ago
parent
commit
e31c514b00
  1. 1
      weed/filesys/file.go
  2. 1
      weed/pb/filer.proto
  3. 106
      weed/pb/filer_pb/filer.pb.go
  4. 2
      weed/server/filer_server_handlers_admin.go
  5. 3
      weed/server/filer_server_handlers_write.go

1
weed/filesys/file.go

@ -175,6 +175,7 @@ func (file *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.
FileId: fileId,
Offset: req.Offset,
Size: uint64(uploadResult.Size),
Mtime: time.Now().UnixNano(),
})
return nil

1
weed/pb/filer.proto

@ -62,6 +62,7 @@ message FileChunk {
string file_id = 1;
int64 offset = 2;
uint64 size = 3;
int64 mtime = 4;
}
message FuseAttributes {

106
weed/pb/filer_pb/filer.pb.go

@ -167,6 +167,7 @@ type FileChunk struct {
FileId string `protobuf:"bytes,1,opt,name=file_id,json=fileId" json:"file_id,omitempty"`
Offset int64 `protobuf:"varint,2,opt,name=offset" json:"offset,omitempty"`
Size uint64 `protobuf:"varint,3,opt,name=size" json:"size,omitempty"`
Mtime int64 `protobuf:"varint,4,opt,name=mtime" json:"mtime,omitempty"`
}
func (m *FileChunk) Reset() { *m = FileChunk{} }
@ -195,6 +196,13 @@ func (m *FileChunk) GetSize() uint64 {
return 0
}
func (m *FileChunk) GetMtime() int64 {
if m != nil {
return m.Mtime
}
return 0
}
type FuseAttributes struct {
FileSize uint64 `protobuf:"varint,1,opt,name=file_size,json=fileSize" json:"file_size,omitempty"`
Mtime int64 `protobuf:"varint,2,opt,name=mtime" json:"mtime,omitempty"`
@ -827,53 +835,53 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("filer.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 762 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x4e, 0xdb, 0x48,
0x14, 0xc6, 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xf3, 0x08, 0x00, 0x00,
// 767 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x56, 0x6d, 0x4f, 0xdb, 0x48,
0x10, 0xc6, 0x38, 0x09, 0x64, 0x12, 0x38, 0x6e, 0x13, 0xc0, 0x17, 0x5e, 0x2e, 0xec, 0x89, 0x13,
0xa7, 0x93, 0xd0, 0x29, 0xf7, 0xa5, 0x1f, 0x8b, 0x80, 0x56, 0x95, 0xa8, 0x90, 0x8c, 0xa8, 0x54,
0x55, 0x22, 0x4a, 0xec, 0x49, 0xba, 0xc2, 0xb1, 0x5d, 0x7b, 0xdd, 0x8a, 0x7e, 0xee, 0x5f, 0xe9,
0x5f, 0xe9, 0xef, 0xaa, 0x76, 0xbd, 0xb1, 0xd7, 0xd8, 0x49, 0x8b, 0xd4, 0x6f, 0xde, 0x79, 0x79,
0xe6, 0xd9, 0x99, 0x79, 0x36, 0x81, 0xd6, 0x84, 0x79, 0x18, 0x9d, 0x86, 0x51, 0xc0, 0x03, 0xb2,
0x2e, 0x0f, 0xc3, 0x70, 0x4c, 0xaf, 0x61, 0xef, 0x2a, 0x08, 0xee, 0x93, 0xf0, 0x82, 0x45, 0xe8,
0xf0, 0x20, 0x7a, 0xb8, 0xf4, 0x79, 0xf4, 0x60, 0xe3, 0x87, 0x04, 0x63, 0x4e, 0xf6, 0xa1, 0xe9,
0xce, 0x1d, 0x96, 0xd1, 0x37, 0x4e, 0x9a, 0x76, 0x6e, 0x20, 0x04, 0x6a, 0xfe, 0x68, 0x86, 0xd6,
0xaa, 0x74, 0xc8, 0x6f, 0x7a, 0x09, 0xfb, 0xd5, 0x80, 0x71, 0x18, 0xf8, 0x31, 0x92, 0x63, 0xa8,
0xa3, 0x30, 0x48, 0xb4, 0xd6, 0xe0, 0xb7, 0xd3, 0x39, 0x95, 0xd3, 0x34, 0x2e, 0xf5, 0xd2, 0x01,
0x90, 0x2b, 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0x6b,
0x8d, 0x68, 0x09, 0x15, 0x92, 0xef, 0x1d, 0x2e, 0x72, 0xcf, 0x01, 0xc7, 0x0d, 0xf9, 0xd7, 0xe7,
0xff, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0x01, 0x52, 0xae, 0x82, 0x09, 0x09, 0x00, 0x00,
}

2
weed/server/filer_server_handlers_admin.go

@ -7,6 +7,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/filer2"
"strconv"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"time"
)
func (fs *FilerServer) registerHandler(w http.ResponseWriter, r *http.Request) {
@ -26,6 +27,7 @@ func (fs *FilerServer) registerHandler(w http.ResponseWriter, r *http.Request) {
Chunks: []*filer_pb.FileChunk{{
FileId: fileId,
Size: fileSize,
Mtime: time.Now().UnixNano(),
}},
}
err = fs.filer.CreateEntry(entry)

3
weed/server/filer_server_handlers_write.go

@ -24,6 +24,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"time"
)
type FilerPostResult struct {
@ -335,6 +336,7 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) {
Chunks: []*filer_pb.FileChunk{{
FileId: fileId,
Size: uint64(r.ContentLength),
Mtime: time.Now().UnixNano(),
}},
}
if db_err := fs.filer.CreateEntry(entry); db_err != nil {
@ -460,6 +462,7 @@ func (fs *FilerServer) doAutoChunk(w http.ResponseWriter, r *http.Request, conte
FileId: fileId,
Offset: chunkOffset,
Size: uint64(chunkBufOffset),
Mtime: time.Now().UnixNano(),
},
)

Loading…
Cancel
Save