Browse Source

go fmt

pull/1513/head
Chris Lu 4 years ago
parent
commit
62d3d3aea0
  1. 2
      weed/filer/filer_delete_entry.go
  2. 14
      weed/s3api/filer_util_tags.go
  3. 44
      weed/server/filer_grpc_server.go
  4. 1
      weed/server/master_grpc_server_volume.go

2
weed/filer/filer_delete_entry.go

@ -77,7 +77,7 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
if lastFileName == "" && !isRecursive && len(entries) > 0 { if lastFileName == "" && !isRecursive && len(entries) > 0 {
// only for first iteration in the loop // only for first iteration in the loop
glog.Errorf("deleting a folder %s has children: %+v ...", entry.FullPath, entries[0].Name()) glog.Errorf("deleting a folder %s has children: %+v ...", entry.FullPath, entries[0].Name())
return nil, nil,fmt.Errorf("fail to delete non-empty folder: %s", entry.FullPath)
return nil, nil, fmt.Errorf("fail to delete non-empty folder: %s", entry.FullPath)
} }
for _, sub := range entries { for _, sub := range entries {

14
weed/s3api/filer_util_tags.go

@ -6,7 +6,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
) )
const(
const (
S3TAG_PREFIX = "s3-" S3TAG_PREFIX = "s3-"
) )
@ -15,8 +15,8 @@ func (s3a *S3ApiServer) getTags(parentDirectoryPath string, entryName string) (t
err = s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { err = s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{ resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{
Directory: parentDirectoryPath,
Name: entryName,
Directory: parentDirectoryPath,
Name: entryName,
}) })
if err != nil { if err != nil {
return err return err
@ -37,8 +37,8 @@ func (s3a *S3ApiServer) setTags(parentDirectoryPath string, entryName string, ta
return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{ resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{
Directory: parentDirectoryPath,
Name: entryName,
Directory: parentDirectoryPath,
Name: entryName,
}) })
if err != nil { if err != nil {
return err return err
@ -73,8 +73,8 @@ func (s3a *S3ApiServer) rmTags(parentDirectoryPath string, entryName string) (er
return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{ resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{
Directory: parentDirectoryPath,
Name: entryName,
Directory: parentDirectoryPath,
Name: entryName,
}) })
if err != nil { if err != nil {
return err return err

44
weed/server/filer_grpc_server.go

@ -32,12 +32,12 @@ func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.L
return &filer_pb.LookupDirectoryEntryResponse{ return &filer_pb.LookupDirectoryEntryResponse{
Entry: &filer_pb.Entry{ Entry: &filer_pb.Entry{
Name: req.Name,
IsDirectory: entry.IsDirectory(),
Attributes: filer.EntryAttributeToPb(entry),
Chunks: entry.Chunks,
Extended: entry.Extended,
HardLinkId: entry.HardLinkId,
Name: req.Name,
IsDirectory: entry.IsDirectory(),
Attributes: filer.EntryAttributeToPb(entry),
Chunks: entry.Chunks,
Extended: entry.Extended,
HardLinkId: entry.HardLinkId,
HardLinkCounter: entry.HardLinkCounter, HardLinkCounter: entry.HardLinkCounter,
}, },
}, nil }, nil
@ -77,12 +77,12 @@ func (fs *FilerServer) ListEntries(req *filer_pb.ListEntriesRequest, stream file
if err := stream.Send(&filer_pb.ListEntriesResponse{ if err := stream.Send(&filer_pb.ListEntriesResponse{
Entry: &filer_pb.Entry{ Entry: &filer_pb.Entry{
Name: entry.Name(),
IsDirectory: entry.IsDirectory(),
Chunks: entry.Chunks,
Attributes: filer.EntryAttributeToPb(entry),
Extended: entry.Extended,
HardLinkId: entry.HardLinkId,
Name: entry.Name(),
IsDirectory: entry.IsDirectory(),
Chunks: entry.Chunks,
Attributes: filer.EntryAttributeToPb(entry),
Extended: entry.Extended,
HardLinkId: entry.HardLinkId,
HardLinkCounter: entry.HardLinkCounter, HardLinkCounter: entry.HardLinkCounter,
}, },
}); err != nil { }); err != nil {
@ -162,11 +162,11 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
} }
createErr := fs.filer.CreateEntry(ctx, &filer.Entry{ createErr := fs.filer.CreateEntry(ctx, &filer.Entry{
FullPath: util.JoinPath(req.Directory, req.Entry.Name),
Attr: filer.PbToEntryAttribute(req.Entry.Attributes),
Chunks: chunks,
Extended: req.Entry.Extended,
HardLinkId: filer.HardLinkId(req.Entry.HardLinkId),
FullPath: util.JoinPath(req.Directory, req.Entry.Name),
Attr: filer.PbToEntryAttribute(req.Entry.Attributes),
Chunks: chunks,
Extended: req.Entry.Extended,
HardLinkId: filer.HardLinkId(req.Entry.HardLinkId),
HardLinkCounter: req.Entry.HardLinkCounter, HardLinkCounter: req.Entry.HardLinkCounter,
}, req.OExcl, req.IsFromOtherCluster, req.Signatures) }, req.OExcl, req.IsFromOtherCluster, req.Signatures)
@ -196,11 +196,11 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
} }
newEntry := &filer.Entry{ newEntry := &filer.Entry{
FullPath: util.JoinPath(req.Directory, req.Entry.Name),
Attr: entry.Attr,
Extended: req.Entry.Extended,
Chunks: chunks,
HardLinkId: filer.HardLinkId(req.Entry.HardLinkId),
FullPath: util.JoinPath(req.Directory, req.Entry.Name),
Attr: entry.Attr,
Extended: req.Entry.Extended,
Chunks: chunks,
HardLinkId: filer.HardLinkId(req.Entry.HardLinkId),
HardLinkCounter: req.Entry.HardLinkCounter, HardLinkCounter: req.Entry.HardLinkCounter,
} }

1
weed/server/master_grpc_server_volume.go

@ -177,4 +177,3 @@ func (ms *MasterServer) LookupEcVolume(ctx context.Context, req *master_pb.Looku
return resp, nil return resp, nil
} }
Loading…
Cancel
Save