Skip to content

Commit

Permalink
Merge pull request #741 from owncloud/implement-index-lowerbound
Browse files Browse the repository at this point in the history
Lower Bound on CS3 Index
  • Loading branch information
kulmann authored Oct 23, 2020
2 parents fd048c7 + a8429bd commit 7f1b58d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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

0 comments on commit 7f1b58d

Please sign in to comment.