Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata storage and indexer #2585

Merged
merged 22 commits into from
Feb 25, 2022

Conversation

aduffeck
Copy link
Contributor

This PR adds the metadata storage layer and the indexer from ocis-pkg. The indexer has also been extended to allow for indexing nested fields and supporting index functions that are necessary for indexing polymorphic fields.

Copy link
Contributor

@kobergj kobergj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general. Just some minors. Allthough I'm not too happy with the extensive use of reflect package as it is pretty slow. But I don't have a better idea right now, so it's acceptable for now...

pkg/storage/utils/indexer/helper.go Outdated Show resolved Hide resolved
pkg/storage/utils/indexer/index/autoincrement.go Outdated Show resolved Hide resolved
pkg/storage/utils/indexer/index/autoincrement.go Outdated Show resolved Hide resolved
pkg/storage/utils/indexer/index/non_unique.go Outdated Show resolved Hide resolved
pkg/storage/utils/indexer/index/unique.go Outdated Show resolved Hide resolved
pkg/storage/utils/indexer/indexer.go Show resolved Hide resolved
pkg/storage/utils/indexer/indexer_test.go Outdated Show resolved Hide resolved
pkg/storage/utils/metadata/cs3.go Outdated Show resolved Hide resolved
pkg/storage/utils/metadata/cs3.go Outdated Show resolved Hide resolved
pkg/storage/utils/sync/mutex.go Show resolved Hide resolved
Copy link
Contributor

@C0rby C0rby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small nitpicks

Comment on lines 89 to 93
var matches = make([]string, 0)
paths, err := idx.storage.ReadDir(context.Background(), path.Join("/", idx.indexRootDir, v))

if err != nil {
return nil, err
}

for _, p := range paths {
matches = append(matches, path.Base(p))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var matches = make([]string, 0)
paths, err := idx.storage.ReadDir(context.Background(), path.Join("/", idx.indexRootDir, v))
if err != nil {
return nil, err
}
for _, p := range paths {
matches = append(matches, path.Base(p))
}
paths, err := idx.storage.ReadDir(context.Background(), path.Join("/", idx.indexRootDir, v))
if err != nil {
return nil, err
}
matches = make([]string, 0, len(paths))
for _, p := range paths {
matches = append(matches, path.Base(p))
}

}
}
default:
return fmt.Errorf("operator not supported")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("operator not supported")
return errors.New("operator not supported")

return nil, err
}

entries := []string{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
entries := []string{}
entries := make([]string, 0, len(infos))

@aduffeck aduffeck force-pushed the add-metadata-storage-and-indexer branch from 9234d98 to 915bf71 Compare February 24, 2022 10:26
@aduffeck aduffeck force-pushed the add-metadata-storage-and-indexer branch from d349276 to ce45140 Compare February 24, 2022 13:26
Copy link
Contributor

@kobergj kobergj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants