-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add metadata storage and indexer #2585
Conversation
There was a problem hiding this 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...
There was a problem hiding this 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
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)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)) | |
} |
pkg/storage/utils/indexer/indexer.go
Outdated
} | ||
} | ||
default: | ||
return fmt.Errorf("operator not supported") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("operator not supported") | |
return errors.New("operator not supported") |
pkg/storage/utils/metadata/disk.go
Outdated
return nil, err | ||
} | ||
|
||
entries := []string{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entries := []string{} | |
entries := make([]string, 0, len(infos)) |
9234d98
to
915bf71
Compare
Spoiler: It doesn't work
That can be used in cases where it's not a single field holding the information, e.g. in case of polymorphism.
d349276
to
ce45140
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
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.