Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
address small review items

Co-authored-by: Alex Unger <6905948+refs@users.noreply.github.com>
  • Loading branch information
butonic and refs committed Jul 2, 2021
1 parent a6b1a07 commit e8d8b4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 6 additions & 4 deletions internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,17 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp
}
}

var providers []*registry.ProviderInfo
var err error
var (
providers []*registry.ProviderInfo
err error
)
c, err := pool.GetStorageRegistryClient(s.c.StorageRegistryEndpoint)
if err != nil {
return nil, errors.Wrap(err, "gateway: error getting storage registry client")
}

if id != nil {
// query that specific story provider
// query that specific storage provider
parts := strings.SplitN(id.OpaqueId, "!", 2)
if len(parts) != 2 {
return &provider.ListStorageSpacesResponse{
Expand Down Expand Up @@ -183,8 +185,8 @@ func (s *svc) ListStorageSpaces(ctx context.Context, req *provider.ListStorageSp

spacesFromProviders := make([][]*provider.StorageSpace, len(providers))
errors := make([]error, len(providers))
var wg sync.WaitGroup

var wg sync.WaitGroup
for i, p := range providers {
wg.Add(1)
go s.listStorageSpacesOnProvider(ctx, req, &spacesFromProviders[i], p, &errors[i], &wg)
Expand Down
11 changes: 5 additions & 6 deletions pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (fs *Decomposedfs) createStorageSpace(spaceType, nodeID string) error {
// we can reuse the node id as the space id
err := os.Symlink("../../nodes/"+nodeID, filepath.Join(fs.o.Root, "spaces", spaceType, nodeID))
if err != nil {
fmt.Printf("could not create symlink for personal space %s, %s\n", nodeID, err)
fmt.Printf("could not create symlink for '%s' space %s, %s\n", spaceType, nodeID, err)
}

return nil
Expand Down Expand Up @@ -507,8 +507,10 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
// /nodes/root/personal/foo and /nodes/root/shares/foo might be two very different spaces, a /nodes/root/foo is not expressive enough
// we would not need /nodes/root if access always happened via spaceid+relative path

spaceType := "*"
spaceID := "*"
var (
spaceType = "*"
spaceID = "*"
)

for i := range filter {
switch filter[i].Type {
Expand Down Expand Up @@ -557,8 +559,6 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide

// TODO apply more filters

// build return value

space := &provider.StorageSpace{
// FIXME the driver should know its id move setting the spaceid from the storage provider to the drivers
//Id: &provider.StorageSpaceId{OpaqueId: "1284d238-aa92-42ce-bdc4-0b0000009157!" + n.ID},
Expand All @@ -577,7 +577,6 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
// do not list shares as spaces for the owner
continue
}
// return folder name?
space.Name = n.Name
} else {
space.Name = "root" // do not expose the id as name, this is the root of a space
Expand Down

0 comments on commit e8d8b4b

Please sign in to comment.