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

indexer: introduce LookupCtx #3043

Merged
merged 5 commits into from
Jul 8, 2022
Merged

indexer: introduce LookupCtx #3043

merged 5 commits into from
Jul 8, 2022

Conversation

butonic
Copy link
Contributor

@butonic butonic commented Jul 7, 2022

The index interface now has a new LookupCtx that can look up multiple values so we can more efficiently look up multiple shares by id. It also takes a context so we can pass on the trace context to the CS3 backend

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

add changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Comment on lines -169 to +176
for _, field := range queryFields {
for _, idx := range fields.IndicesByField[strcase.ToCamel(field.Name)] {
res, err := idx.Lookup(field.Value)
for fieldName, queryFields := range groupFieldsByName(queryFields) {
idxes := fields.IndicesByField[strcase.ToCamel(fieldName)]
values := make([]string, 0, len(queryFields))
for _, f := range queryFields {
values = append(values, f.Value)
}
for _, idx := range idxes {
res, err := idx.LookupCtx(context.Background(), values...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

here we no longer make one Lookup call per queryField but instead aggregate by field name and then use the new LookupCtx to fetch all results at once.

I introduced the context because we want to be able to pass the trace context into the index as well ...

@butonic butonic marked this pull request as ready for review July 7, 2022 15:04
@butonic butonic requested review from a team, labkode, ishank011 and glpatcern as code owners July 7, 2022 15:04
@butonic butonic self-assigned this Jul 7, 2022
pkg/publicshare/manager/cs3/cs3.go Outdated Show resolved Hide resolved
pkg/publicshare/manager/cs3/cs3.go Outdated Show resolved Hide resolved
pkg/storage/utils/indexer/index/autoincrement.go Outdated Show resolved Hide resolved
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Co-authored-by: David Christofas <dchristofas@posteo.de>
@butonic butonic force-pushed the lookupctx branch 2 times, most recently from 14fe7d2 to b183d96 Compare July 8, 2022 13:39
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic butonic merged commit 047ab30 into cs3org:edge Jul 8, 2022
@butonic butonic deleted the lookupctx branch July 8, 2022 15:21
kobergj pushed a commit to kobergj/reva that referenced this pull request Jul 11, 2022
* indexer: introduce LookupCtx

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

add changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use sets instead af arrays

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* Update pkg/storage/utils/indexer/index/autoincrement.go

Co-authored-by: David Christofas <dchristofas@posteo.de>

* fix logic

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* ignore result order

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Co-authored-by: David Christofas <dchristofas@posteo.de>
@micbar micbar mentioned this pull request Jul 19, 2022
36 tasks
@kobergj kobergj mentioned this pull request Dec 19, 2022
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.

None yet

2 participants