Skip to content

Commit

Permalink
remove more obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Apr 24, 2024
1 parent b238361 commit ed37f23
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
60 changes: 0 additions & 60 deletions pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,6 @@ func (fs *eosfs) getInternalHome(ctx context.Context) (string, error) {
return relativeHome, nil
}

func (fs *eosfs) wrapShadow(ctx context.Context, fn string) (internal string) {
if fs.conf.EnableHome {
layout, err := fs.getInternalHome(ctx)
if err != nil {
panic(err)
}
internal = path.Join(fs.conf.ShadowNamespace, layout, fn)
} else {
internal = path.Join(fs.conf.ShadowNamespace, fn)
}
return
}

func (fs *eosfs) wrap(ctx context.Context, fn string) (internal string) {
if fs.conf.EnableHome {
layout, err := fs.getInternalHome(ctx)
Expand Down Expand Up @@ -460,20 +447,6 @@ func (fs *eosfs) getPath(ctx context.Context, id *provider.ResourceId) (string,
return fs.unwrap(ctx, eosFileInfo.File)
}

func (fs *eosfs) isShareFolder(ctx context.Context, p string) bool {
return strings.HasPrefix(p, fs.conf.ShareFolder)
}

func (fs *eosfs) isShareFolderRoot(ctx context.Context, p string) bool {
return path.Clean(p) == fs.conf.ShareFolder
}

func (fs *eosfs) isShareFolderChild(ctx context.Context, p string) bool {
p = path.Clean(p)
vals := strings.Split(p, fs.conf.ShareFolder+"/")
return len(vals) > 1 && vals[1] != ""
}

func (fs *eosfs) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error) {
fid, err := strconv.ParseUint(id.OpaqueId, 10, 64)
if err != nil {
Expand Down Expand Up @@ -1258,25 +1231,6 @@ func (fs *eosfs) GetMD(ctx context.Context, ref *provider.Reference, mdKeys []st
return fs.convertToResourceInfo(ctx, eosFileInfo)
}

func (fs *eosfs) getMDShareFolder(ctx context.Context, p string, mdKeys []string) (*provider.ResourceInfo, error) {
fn := fs.wrapShadow(ctx, p)

auth, err := fs.getRootAuth(ctx)
if err != nil {
return nil, err
}

eosFileInfo, err := fs.c.GetFileInfoByPath(ctx, auth, fn)
if err != nil {
return nil, err
}

if fs.isShareFolderRoot(ctx, p) {
return fs.convertToResourceInfo(ctx, eosFileInfo)
}
return fs.convertToFileReference(ctx, eosFileInfo)
}

func (fs *eosfs) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string) ([]*provider.ResourceInfo, error) {
p, err := fs.resolve(ctx, ref)
if err != nil {
Expand Down Expand Up @@ -1872,20 +1826,6 @@ func (fs *eosfs) convertToResourceInfo(ctx context.Context, eosFileInfo *eosclie
return fs.convert(ctx, eosFileInfo)
}

func (fs *eosfs) convertToFileReference(ctx context.Context, eosFileInfo *eosclient.FileInfo) (*provider.ResourceInfo, error) {
info, err := fs.convert(ctx, eosFileInfo)
if err != nil {
return nil, err
}
info.Type = provider.ResourceType_RESOURCE_TYPE_REFERENCE
val, ok := eosFileInfo.Attrs["reva.target"]
if !ok || val == "" {
return nil, errtypes.InternalError("eosfs: reference does not contain target: target=" + val + " file=" + eosFileInfo.File)
}
info.Target = val
return info, nil
}

// permissionSet returns the permission set for the current user.
func (fs *eosfs) permissionSet(ctx context.Context, eosFileInfo *eosclient.FileInfo, owner *userpb.UserId) *provider.ResourcePermissions {
u, ok := appctx.ContextGetUser(ctx)
Expand Down
4 changes: 0 additions & 4 deletions pkg/storage/utils/eosfs/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ func (fs *eosfs) Upload(ctx context.Context, ref *provider.Reference, r io.ReadC
return errors.Wrap(err, "eos: error resolving reference")
}

if fs.isShareFolder(ctx, p) {
return errtypes.PermissionDenied("eos: cannot upload under the virtual share folder")
}

ok, err := chunking.IsChunked(p)
if err != nil {
return errors.Wrap(err, "eos: error checking path")
Expand Down

0 comments on commit ed37f23

Please sign in to comment.