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

Lower Bound on CS3 Index #741

Merged
merged 2 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions accounts/pkg/indexer/index/cs3/autoincrement.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Autoincrement struct {
dataProvider dataProviderClient // Used to create and download data via http, bypassing reva upload protocol

cs3conf *Config
bound *option.Bound
}

func init() {
Expand All @@ -58,6 +59,7 @@ func NewAutoincrementIndex(o ...option.Option) index.Index {
indexBy: opts.IndexBy,
typeName: opts.TypeName,
filesDir: opts.FilesDir,
bound: opts.Bound,
indexBaseDir: path.Join(opts.DataDir, "index.cs3"),
indexRootDir: path.Join(path.Join(opts.DataDir, "index.cs3"), strings.Join([]string{"autoincrement", opts.TypeName, opts.IndexBy}, ".")),
cs3conf: &Config{
Expand Down Expand Up @@ -356,5 +358,10 @@ func (idx *Autoincrement) next() (int, error) {
if err != nil {
return -1, err
}

if int64(latest) < idx.bound.Lower {
return int(idx.bound.Lower), nil
}

return latest + 1, nil
}
7 changes: 7 additions & 0 deletions changelog/unreleased/cs3-index-lowerbound.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Lower Bound was not working for the cs3 api index implementation

Tags: accounts

Lower bound working on the cs3 index implementation

https://github.com/owncloud/ocis/pull/741