drop /meta mount prefix

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2021-11-09 10:06:58 +00:00
parent 5a29959a0b
commit b63b322b6f
7 changed files with 26 additions and 17 deletions

View File

@@ -102,7 +102,7 @@ func (r CS3Repo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err err
res, err := r.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join(storageMountPath, accountsFolder),
Path: path.Join("/", accountsFolder),
},
})
if err != nil {
@@ -142,7 +142,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(storageMountPath, accountsFolder, id),
Path: path.Join("/", accountsFolder, id),
},
})
@@ -197,7 +197,7 @@ func (r CS3Repo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)
res, err := r.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join(storageMountPath, groupsFolder),
Path: path.Join("/", groupsFolder),
},
})
if err != nil {
@@ -237,7 +237,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(storageMountPath, groupsFolder, id),
Path: path.Join("/", groupsFolder, id),
},
})
@@ -295,7 +295,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(storageMountPath, folder),
Path: path.Join("/", folder),
}
resp, err := sp.Stat(ctx, &provider.StatRequest{

View File

@@ -162,7 +162,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,
@@ -203,7 +203,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: path.Join("/", idx.indexRootDir),
},
})
@@ -301,7 +301,11 @@ func (idx *Autoincrement) next() (int, error) {
res, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
<<<<<<< HEAD
Path: path.Join("/meta", idx.indexRootDir), //TODO:
=======
Path: path.Join("/", idx.indexRootDir),
>>>>>>> 7a5fb4c2e (drop /meta mount prefix)
},
})

View File

@@ -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 {

View File

@@ -119,7 +119,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),
},
})
@@ -172,7 +172,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,
@@ -187,7 +187,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,
@@ -198,7 +198,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,
@@ -245,7 +245,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: path.Join("/", idx.indexRootDir),
},
})

View File

@@ -32,7 +32,7 @@ package cs3
// sut := NewNonUniqueIndexWithOptions(
// option.WithTypeName(GetTypeFQN(User{})),
// option.WithIndexBy("UserName"),
// option.WithFilesDir(path.Join(cfg.Repo.Disk.Path, "/meta")),
// option.WithFilesDir(path.Join(cfg.Repo.Disk.Path, "/")),
// option.WithDataDir(cfg.Repo.Disk.Path),
// option.WithDataURL(cfg.Repo.CS3.DataURL),
// option.WithDataPrefix(cfg.Repo.CS3.DataPrefix),

View File

@@ -162,7 +162,12 @@ func (idx *Unique) Remove(id string, v string) error {
return err
}
<<<<<<< HEAD
deletePath := path.Join("/meta", idx.indexRootDir, v)
=======
deletePath := path.Join("/", idx.indexRootDir, v)
ctx = metadata.AppendToOutgoingContext(ctx, revactx.TokenHeader, t)
>>>>>>> 7a5fb4c2e (drop /meta mount prefix)
resp, err := idx.storageProvider.Delete(ctx, &provider.DeleteRequest{
Ref: &provider.Reference{
Path: deletePath,
@@ -212,7 +217,7 @@ func (idx *Unique) Search(pattern string) ([]string, error) {
res, err := idx.storageProvider.ListContainer(ctx, &provider.ListContainerRequest{
Ref: &provider.Reference{
Path: path.Join("/meta", idx.indexRootDir),
Path: path.Join("/", idx.indexRootDir),
},
})

View File

@@ -32,7 +32,7 @@ package cs3
// sut := NewUniqueIndexWithOptions(
// option.WithTypeName(GetTypeFQN(User{})),
// option.WithIndexBy("UserName"),
// option.WithFilesDir(path.Join(cfg.Repo.Disk.Path, "/meta")),
// option.WithFilesDir(path.Join(cfg.Repo.Disk.Path, "/")),
// option.WithDataDir(cfg.Repo.Disk.Path),
// option.WithDataURL(cfg.Repo.CS3.DataURL),
// option.WithDataPrefix(cfg.Repo.CS3.DataPrefix),
@@ -82,7 +82,7 @@ package cs3
// sut := NewUniqueIndexWithOptions(
// option.WithTypeName(GetTypeFQN(User{})),
// option.WithIndexBy("UserName"),
// option.WithFilesDir(path.Join(cfg.Repo.Disk.Path, "/meta")),
// option.WithFilesDir(path.Join(cfg.Repo.Disk.Path, "/")),
// option.WithDataDir(cfg.Repo.Disk.Path),
// option.WithDataURL(cfg.Repo.CS3.DataURL),
// option.WithDataPrefix(cfg.Repo.CS3.DataPrefix),