breaks dependency loop

This commit is contained in:
Chris Lu
2020-03-07 17:01:39 -08:00
parent 8645283a7b
commit afb20de14c
19 changed files with 39 additions and 39 deletions

View File

@@ -2,10 +2,10 @@ package filer_pb
import (
"context"
"errors"
"fmt"
"strings"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
)
@@ -88,23 +88,18 @@ func CreateEntry(client SeaweedFilerClient, request *CreateEntryRequest) error {
}
func LookupEntry(client SeaweedFilerClient, request *LookupDirectoryEntryRequest) (*LookupDirectoryEntryResponse, error) {
resp, err := filer_pb.LookupEntry(client, request)
resp, err := client.LookupDirectoryEntry(context.Background(), request)
if err != nil {
if err == filer2.ErrNotFound || strings.Contains(err.Error(), ErrNotFound.Error()) {
return nil, filer2.ErrNotFound
if err == ErrNotFound || strings.Contains(err.Error(), ErrNotFound.Error()) {
return nil, ErrNotFound
}
glog.V(3).Infof("read %s/%v: %v", request.Directory, request.Entry.Name, err)
glog.V(3).Infof("read %s/%v: %v", request.Directory, request.Name, err)
return nil, fmt.Errorf("LookupEntry1: %v", err)
}
if resp.Error != "" && strings.Contains(resp.Error, ErrNotFound.Error()) {
return nil, filer2.ErrNotFound
}
if resp.Error != "" {
glog.V(3).Infof("lookup %s/%v: %v", request.Directory, request.Entry.Name, err)
return nil, fmt.Errorf("LookupEntry2: %v", err)
}
if resp.Entry == nil {
return nil, filer2.ErrNotFound
return nil, ErrNotFound
}
return resp, nil
}
var ErrNotFound = errors.New("filer: no entry is found in filer store")