Skip to content

Commit

Permalink
Change method name
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Nov 11, 2021
1 parent 125427d commit 3a5661b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions pkg/storage/utils/decomposedfs/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func ReadNode(ctx context.Context, lu PathLookup, id string) (n *Node, err error
switch {
case err == nil:
n.ParentID = string(attrBytes)
case isNoData(err):
case isAttrUnset(err):
return nil, errtypes.InternalError(err.Error())
case isNotFound(err):
return n, nil // swallow not found, the node defaults to exists = false
Expand Down Expand Up @@ -326,7 +326,7 @@ func (n *Node) Owner() (*userpb.UserId, error) {
switch {
case err == nil:
owner.OpaqueId = string(attrBytes)
case isNoData(err), isNotFound(err):
case isAttrUnset(err), isNotFound(err):
fallthrough
default:
return nil, err
Expand All @@ -337,7 +337,7 @@ func (n *Node) Owner() (*userpb.UserId, error) {
switch {
case err == nil:
owner.Idp = string(attrBytes)
case isNoData(err), isNotFound(err):
case isAttrUnset(err), isNotFound(err):
fallthrough
default:
return nil, err
Expand All @@ -348,7 +348,7 @@ func (n *Node) Owner() (*userpb.UserId, error) {
switch {
case err == nil:
owner.Type = utils.UserTypeMap(string(attrBytes))
case isNoData(err), isNotFound(err):
case isAttrUnset(err), isNotFound(err):
fallthrough
default:
// TODO the user type defaults to invalid, which is the case
Expand Down Expand Up @@ -675,7 +675,7 @@ func readChecksumIntoResourceChecksum(ctx context.Context, nodePath, algo string
Type: storageprovider.PKG2GRPCXS(algo),
Sum: hex.EncodeToString(v),
}
case isNoData(err):
case isAttrUnset(err):
appctx.GetLogger(ctx).Debug().Err(err).Str("nodepath", nodePath).Str("algorithm", algo).Msg("checksum not set")
case isNotFound(err):
appctx.GetLogger(ctx).Error().Err(err).Str("nodepath", nodePath).Str("algorithm", algo).Msg("file not fount")
Expand All @@ -697,7 +697,7 @@ func readChecksumIntoOpaque(ctx context.Context, nodePath, algo string, ri *prov
Decoder: "plain",
Value: []byte(hex.EncodeToString(v)),
}
case isNoData(err):
case isAttrUnset(err):
appctx.GetLogger(ctx).Debug().Err(err).Str("nodepath", nodePath).Str("algorithm", algo).Msg("checksum not set")
case isNotFound(err):
appctx.GetLogger(ctx).Error().Err(err).Str("nodepath", nodePath).Str("algorithm", algo).Msg("file not fount")
Expand Down Expand Up @@ -729,7 +729,7 @@ func readQuotaIntoOpaque(ctx context.Context, nodePath string, ri *provider.Reso
} else {
appctx.GetLogger(ctx).Error().Err(err).Str("nodepath", nodePath).Str("quota", string(v)).Msg("malformed quota")
}
case isNoData(err):
case isAttrUnset(err):
appctx.GetLogger(ctx).Debug().Err(err).Str("nodepath", nodePath).Msg("quota not set")
case isNotFound(err):
appctx.GetLogger(ctx).Error().Err(err).Str("nodepath", nodePath).Msg("file not found when reading quota")
Expand Down Expand Up @@ -856,7 +856,7 @@ func (n *Node) ReadUserPermissions(ctx context.Context, u *userpb.User) (ap prov
switch {
case err == nil:
AddPermissions(&ap, g.GetPermissions())
case isNoData(err):
case isAttrUnset(err):
err = nil
appctx.GetLogger(ctx).Error().Interface("node", n).Str("grant", grantees[i]).Interface("grantees", grantees).Msg("grant vanished from node after listing")
// continue with next segment
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/node/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (p *Permissions) HasPermission(ctx context.Context, n *Node, check func(*pr
if check(g.GetPermissions()) {
return true, nil
}
case isNoData(err):
case isAttrUnset(err):
err = nil
appctx.GetLogger(ctx).Error().Interface("node", cn).Str("grant", grantees[i]).Interface("grantees", grantees).Msg("grant vanished from node after listing")
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/node/permissions_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/pkg/xattr"
)

func isNoData(err error) bool {
func isAttrUnset(err error) bool {
if xerr, ok := err.(*xattr.Error); ok {
if serr, ok2 := xerr.Err.(syscall.Errno); ok2 {
return serr == syscall.ENOATTR
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/node/permissions_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/pkg/xattr"
)

func isNoData(err error) bool {
func isAttrUnset(err error) bool {
if xerr, ok := err.(*xattr.Error); ok {
if serr, ok2 := xerr.Err.(syscall.Errno); ok2 {
return serr == syscall.ENODATA
Expand Down

0 comments on commit 3a5661b

Please sign in to comment.