Skip to content

Commit

Permalink
ocis changes for the reva wrap-unwrap refactoring
Browse files Browse the repository at this point in the history
these changes are necessary when you want to test the wrap unwrap changes in reva
  • Loading branch information
David Christofas committed Aug 25, 2021
1 parent 291b5fa commit b315c81
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions accounts/pkg/storage/cs3.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (r CS3Repo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err err
ctx = metadata.AppendToOutgoingContext(ctx, revactx.TokenHeader, t)
res, err := r.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", accountsFolder),
Path: accountsFolder,
},
})
if err != nil {
Expand Down Expand Up @@ -159,7 +159,7 @@ func (r CS3Repo) DeleteAccount(ctx context.Context, id string) (err error) {

resp, err := r.storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", accountsFolder, id),
Path: path.Join(accountsFolder, id),
},
})

Expand Down Expand Up @@ -222,7 +222,7 @@ func (r CS3Repo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)
ctx = metadata.AppendToOutgoingContext(ctx, revactx.TokenHeader, t)
res, err := r.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", groupsFolder),
Path: groupsFolder,
},
})
if err != nil {
Expand Down Expand Up @@ -273,7 +273,7 @@ func (r CS3Repo) DeleteGroup(ctx context.Context, id string) (err error) {

resp, err := r.storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", groupsFolder, id),
Path: path.Join(groupsFolder, id),
},
})

Expand Down Expand Up @@ -325,7 +325,7 @@ func (r CS3Repo) makeRootDirIfNotExist(ctx context.Context, folder string) error
// MakeDirIfNotExist will create a root node in the metadata storage. Requires an authenticated context.
func MakeDirIfNotExist(ctx context.Context, sp provider.ProviderAPIClient, folder string) error {
var rootPathRef = &provider.Reference{
Path: path.Join("/meta", folder),
Path: folder,
}

resp, err := sp.Stat(ctx, &provider.StatRequest{
Expand Down
6 changes: 3 additions & 3 deletions ocis-pkg/indexer/index/cs3/autoincrement.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (idx *Autoincrement) Remove(id string, v string) error {
return err
}

deletePath := path.Join("/meta", idx.indexRootDir, v)
deletePath := path.Join(idx.indexRootDir, v)
resp, err := idx.storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Path: deletePath,
Expand Down Expand Up @@ -215,7 +215,7 @@ func (idx *Autoincrement) Search(pattern string) ([]string, error) {

res, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", idx.indexRootDir),
Path: idx.indexRootDir,
},
})

Expand Down Expand Up @@ -328,7 +328,7 @@ func (idx *Autoincrement) next() (int, error) {

res, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", idx.indexRootDir),
Path: idx.indexRootDir,
},
})

Expand Down
2 changes: 1 addition & 1 deletion ocis-pkg/indexer/index/cs3/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func deleteIndexRoot(ctx context.Context, storageProvider provider.ProviderAPIClient, indexRootDir string) error {
res, err := storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", indexRootDir),
Path: path.Join("/", indexRootDir),
},
})
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions ocis-pkg/indexer/index/cs3/non_unique.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (idx *NonUnique) Lookup(v string) ([]string, error) {

res, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", idx.indexRootDir, v),
Path: path.Join(idx.indexRootDir, v),
},
})

Expand Down Expand Up @@ -190,7 +190,7 @@ func (idx *NonUnique) Remove(id string, v string) error {
return err
}

deletePath := path.Join("/meta", idx.indexRootDir, v, id)
deletePath := path.Join(idx.indexRootDir, v, id)
resp, err := idx.storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Path: deletePath,
Expand All @@ -205,7 +205,7 @@ func (idx *NonUnique) Remove(id string, v string) error {
return &idxerrs.NotFoundErr{TypeName: idx.typeName, Key: idx.indexBy, Value: v}
}

toStat := path.Join("/meta", idx.indexRootDir, v)
toStat := path.Join(idx.indexRootDir, v)
lcResp, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: toStat,
Expand All @@ -216,7 +216,7 @@ func (idx *NonUnique) Remove(id string, v string) error {
}

if len(lcResp.Infos) == 0 {
deletePath = path.Join("/meta", idx.indexRootDir, v)
deletePath = path.Join(idx.indexRootDir, v)
_, err := idx.storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Path: deletePath,
Expand Down Expand Up @@ -263,7 +263,7 @@ func (idx *NonUnique) Search(pattern string) ([]string, error) {
matches := make([]string, 0)
res, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", idx.indexRootDir),
Path: idx.indexRootDir,
},
})

Expand Down
6 changes: 3 additions & 3 deletions ocis-pkg/indexer/index/cs3/unique.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewUniqueIndexWithOptions(o ...option.Option) index.Index {
typeName: opts.TypeName,
filesDir: opts.FilesDir,
indexBaseDir: path.Join(opts.DataDir, "index.cs3"),
indexRootDir: path.Join(path.Join(opts.DataDir, "index.cs3"), strings.Join([]string{"unique", opts.TypeName, opts.IndexBy}, ".")),
indexRootDir: path.Join("/", opts.DataDir, "index.cs3", strings.Join([]string{"unique", opts.TypeName, opts.IndexBy}, ".")),
cs3conf: &Config{
ProviderAddr: opts.ProviderAddr,
DataURL: opts.DataURL,
Expand Down Expand Up @@ -188,7 +188,7 @@ func (idx *Unique) Remove(id string, v string) error {
return err
}

deletePath := path.Join("/meta", idx.indexRootDir, v)
deletePath := path.Join(idx.indexRootDir, v)
ctx = metadata.AppendToOutgoingContext(ctx, revactx.TokenHeader, t)
resp, err := idx.storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Expand Down Expand Up @@ -241,7 +241,7 @@ func (idx *Unique) Search(pattern string) ([]string, error) {
ctx = metadata.AppendToOutgoingContext(ctx, revactx.TokenHeader, t)
res, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", idx.indexRootDir),
Path: idx.indexRootDir,
},
})

Expand Down
8 changes: 4 additions & 4 deletions storage/pkg/command/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ func rules(cfg *config.Config, logger log.Logger) map[string]map[string]interfac

// generate rules based on default config
return map[string]map[string]interface{}{
cfg.Reva.StorageHome.MountPath: {"address": cfg.Reva.StorageHome.Endpoint},
cfg.Reva.StorageHome.MountID: {"address": cfg.Reva.StorageHome.Endpoint},
cfg.Reva.StorageUsers.MountPath: {"address": cfg.Reva.StorageUsers.Endpoint},
cfg.Reva.StorageUsers.MountID + ".*": {"address": cfg.Reva.StorageUsers.Endpoint},
cfg.Reva.StorageHome.MountPath: {"address": cfg.Reva.StorageHome.Endpoint, "provider_id": cfg.Reva.StorageUsers.MountID},
cfg.Reva.StorageHome.MountID: {"address": cfg.Reva.StorageHome.Endpoint, "provider_id": cfg.Reva.StorageUsers.MountID},
cfg.Reva.StorageUsers.MountPath: {"address": cfg.Reva.StorageUsers.Endpoint, "provider_id": cfg.Reva.StorageUsers.MountID},
cfg.Reva.StorageUsers.MountID + ".*": {"address": cfg.Reva.StorageUsers.Endpoint, "provider_id": cfg.Reva.StorageUsers.MountID, "provider_path": cfg.Reva.StorageUsers.MountPath},
cfg.Reva.StoragePublicLink.MountPath: {"address": cfg.Reva.StoragePublicLink.Endpoint},
// public link storage returns the mount id of the actual storage
// medatada storage not part of the global namespace
Expand Down

0 comments on commit b315c81

Please sign in to comment.