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 spaceindex.AddAll() #4502

Merged
merged 1 commit into from
Feb 6, 2024
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
5 changes: 5 additions & 0 deletions changelog/unreleased/spaceindex-addall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: add spaceindex.AddAll()

We now expose an AddAll() function that allows adding multiple entries to a space index with a single lock.

https://github.com/cs3org/reva/pull/4502
6 changes: 6 additions & 0 deletions pkg/storage/utils/decomposedfs/spaceidindex/spaceidindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ func (i *Index) Load(index string) (map[string]string, error) {
}

// Add adds an entry to an index
// Consider calling AddAll() when trying to add multiple entries as every Add call has to lock the index
func (i *Index) Add(index, key string, value string) error {
return i.updateIndex(index, map[string]string{key: value}, []string{})
}

// AddAll adds multiple entries to the index
func (i *Index) AddAll(index string, m map[string]string) error {
return i.updateIndex(index, m, []string{})
}

// Remove removes an entry from the index
func (i *Index) Remove(index, key string) error {
return i.updateIndex(index, map[string]string{}, []string{key})
Expand Down
Loading