mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-17 17:51:20 +08:00
filer copy added uid/gid
This commit is contained in:
@@ -59,11 +59,13 @@ func (fs *FilerServer) ListEntries(ctx context.Context, req *filer_pb.ListEntrie
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (fs *FilerServer) GetFileAttributes(ctx context.Context, req *filer_pb.GetFileAttributesRequest) (*filer_pb.GetFileAttributesResponse, error) {
|
||||
func (fs *FilerServer) GetEntryAttributes(ctx context.Context, req *filer_pb.GetEntryAttributesRequest) (*filer_pb.GetEntryAttributesResponse, error) {
|
||||
|
||||
attributes := &filer_pb.FuseAttributes{}
|
||||
|
||||
found, entry, err := fs.filer.FindEntry(filer2.NewFullPath(req.ParentDir, req.Name))
|
||||
fullpath := filer2.NewFullPath(req.ParentDir, req.Name)
|
||||
|
||||
found, entry, err := fs.filer.FindEntry(fullpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -77,7 +79,9 @@ func (fs *FilerServer) GetFileAttributes(ctx context.Context, req *filer_pb.GetF
|
||||
attributes.Mtime = entry.Mtime.Unix()
|
||||
}
|
||||
|
||||
return &filer_pb.GetFileAttributesResponse{
|
||||
glog.V(0).Infof("GetEntryAttributes %v: %+v", fullpath, attributes)
|
||||
|
||||
return &filer_pb.GetEntryAttributesResponse{
|
||||
Attributes: attributes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -19,10 +19,24 @@ func (fs *FilerServer) registerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
writeJsonError(w, r, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
uid, err := strconv.ParseUint(r.FormValue("uid"), 10, 64)
|
||||
if err != nil && r.FormValue("uid") != "" {
|
||||
glog.V(0).Infof("register %s to %s parse uid %s: %v", fileId, path, r.FormValue("uid"), err)
|
||||
writeJsonError(w, r, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
gid, err := strconv.ParseUint(r.FormValue("gid"), 10, 64)
|
||||
if err != nil && r.FormValue("gid") != "" {
|
||||
glog.V(0).Infof("register %s to %s parse gid %s: %v", fileId, path, r.FormValue("gid"), err)
|
||||
writeJsonError(w, r, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
entry := &filer2.Entry{
|
||||
FullPath: filer2.FullPath(path),
|
||||
Attr: filer2.Attr{
|
||||
Mode: 0660,
|
||||
Uid: uint32(uid),
|
||||
Gid: uint32(gid),
|
||||
},
|
||||
Chunks: []*filer_pb.FileChunk{{
|
||||
FileId: fileId,
|
||||
|
||||
Reference in New Issue
Block a user