Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Dec 15, 2021
1 parent 743e7a3 commit 99da3c0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
4 changes: 1 addition & 3 deletions internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,12 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St
appctx.GetLogger(ctx).Warn().Msg("gateway: more than one provider found for root, picking first")
// what if there is more than one provider? pick random one?
}
spaceID := ""
mp := shareProviderInfos[0].ProviderPath

spacePaths := decodeSpacePaths(shareProviderInfos[0].Opaque)
if len(spacePaths) == 0 {
spacePaths[""] = mountPath
}
for spaceID, mp = range spacePaths {
for spaceID, mp := range spacePaths {
shareRootSpace, shareRootNode := utils.SplitStorageSpaceID(spaceID)
if shareRootSpace == statResp.Info.Id.StorageId && shareRootNode == spaceRoot {
mountPath = mp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStora
}, nil
}
case provider.ListStorageSpacesRequest_Filter_TYPE_ID:
//var spaceid string
_, nodeid = utils.SplitStorageSpaceID(f.GetId().OpaqueId)
}
}
Expand All @@ -330,11 +329,6 @@ func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStora
res := &provider.ListStorageSpacesResponse{}
for i := range lsRes.Shares {

//if lsRes.Shares[i].MountPoint == nil {
// TODO return all as type "share", only mounted ones below also as "reference"?
// the gateway needs a name to use as the path segment in the dir listing
// continue
//}
if nodeid != "" && nodeid != lsRes.Shares[i].Share.ResourceId.OpaqueId {
// only a specific share was requested
continue
Expand Down Expand Up @@ -486,10 +480,6 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide
// Change the MountPoint of the share, it has no relative prefix
srcReceivedShare.MountPoint = &provider.Reference{
// FIXME actually it does have a resource id: the one of the sharesstorageprovider
//ResourceId: &provider.ResourceId{
// StorageId: "a0ca6a90-a365-4782-871e-d44447bbc668",
// OpaqueId: "a0ca6a90-a365-4782-871e-d44447bbc668", // FIXME or use the node id of the resource?
//},
Path: filepath.Base(req.Destination.Path),
}

Expand Down Expand Up @@ -579,8 +569,10 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide
})

if err == nil && sRes.Status.Code == rpc.Code_CODE_OK {
// overwrite id to make subsequent stat calls use the mount point
// of the sharesstorageprovider to build absolute paths
// TODO use share id as opaque id?
sRes.Info.Id.StorageId = "a0ca6a90-a365-4782-871e-d44447bbc668"
//sRes.Info.Path = "" // the path of a share is determined by the mount point
}

return sRes, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,13 +831,13 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
} else {
var status *rpc.Status
// FIXME the ResourceID is the id of the resource, but we want the id of the mount point so we can fetch that path, well we have the mountpoint path in the receivedshare
//info, status, err = h.getResourceInfoByID(ctx, client, rs.Share.ResourceId)

// first stat mount point
info, status, err = h.getResourceInfoByID(ctx, client, &provider.ResourceId{
StorageId: "a0ca6a90-a365-4782-871e-d44447bbc668",
OpaqueId: rs.Share.ResourceId.OpaqueId,
})
if err != nil || status.Code != rpc.Code_CODE_OK {
// fallback to unmounted resource
info, status, err = h.getResourceInfoByID(ctx, client, rs.Share.ResourceId)
if err != nil || status.Code != rpc.Code_CODE_OK {
h.logProblems(status, err, "could not stat, skipping")
Expand Down Expand Up @@ -923,15 +923,6 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
response.WriteOCSSuccess(w, r, shares)
}

func findMatch(shareJailInfos []*provider.ResourceInfo, id *provider.ResourceId) *provider.ResourceInfo {
for i := range shareJailInfos {
if shareJailInfos[i].Id != nil && shareJailInfos[i].Id.StorageId == id.StorageId && shareJailInfos[i].Id.OpaqueId == id.OpaqueId {
return shareJailInfos[i]
}
}
return nil
}

func (h *Handler) listSharesWithOthers(w http.ResponseWriter, r *http.Request) {
shares := make([]*conversions.ShareData, 0)

Expand Down
1 change: 0 additions & 1 deletion pkg/storage/utils/decomposedfs/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,6 @@ func (n *Node) ReadUserPermissions(ctx context.Context, u *userpb.User) (provide
userace := xattrs.GrantPrefix + xattrs.UserAcePrefix + u.Id.OpaqueId
userFound := false
for i := range grantees {
err = nil
switch {
// we only need to find the user once
case !userFound && grantees[i] == userace:
Expand Down

0 comments on commit 99da3c0

Please sign in to comment.