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

feat: add counting bloom filter #519

Merged
merged 6 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
style: shorter return
  • Loading branch information
proost committed Apr 6, 2024
commit bc2f494e049ece15d4fd12635c18d55c207c7138
18 changes: 3 additions & 15 deletions rueidisprob/bloomfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ func (c *bloomFilter) AddMulti(ctx context.Context, keys []string) error {
args = append(args, indexes...)

resp := c.addMultiScript.Exec(ctx, c.client, c.addMultiKeys, args)
if resp.Error() != nil {
return resp.Error()
}

return nil
return resp.Error()
}

func (c *bloomFilter) indexes(keys []string) []string {
Expand Down Expand Up @@ -305,11 +301,7 @@ func (c *bloomFilter) Reset(ctx context.Context) error {
Key(c.name, c.counter).
Build(),
)
if resp.Error() != nil {
return resp.Error()
}

return nil
return resp.Error()
}

func (c *bloomFilter) Delete(ctx context.Context) error {
Expand All @@ -322,11 +314,7 @@ func (c *bloomFilter) Delete(ctx context.Context) error {
Key(c.name, c.counter).
Build(),
)
if resp.Error() != nil {
return resp.Error()
}

return nil
return resp.Error()
}

func (c *bloomFilter) Count(ctx context.Context) (uint, error) {
Expand Down
18 changes: 3 additions & 15 deletions rueidisprob/countingbloomfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,7 @@ func (f *countingBloomFilter) AddMulti(ctx context.Context, keys []string) error
args = append(args, indexes...)

resp := f.addMultiScript.Exec(ctx, f.client, f.addMultiKeys, args)
if resp.Error() != nil {
return resp.Error()
}

return nil
return resp.Error()
}

func (f *countingBloomFilter) indexes(keys []string) []string {
Expand Down Expand Up @@ -320,11 +316,7 @@ func (f *countingBloomFilter) RemoveMulti(ctx context.Context, keys []string) er
args = append(args, indexes...)

resp := f.removeMultiScript.Exec(ctx, f.client, f.removeMultiKeys, args)
if resp.Error() != nil {
return resp.Error()
}

return nil
return resp.Error()
}

func (f *countingBloomFilter) Delete(ctx context.Context) error {
Expand All @@ -337,11 +329,7 @@ func (f *countingBloomFilter) Delete(ctx context.Context) error {
Key(f.name, f.counter).
Build(),
)
if resp.Error() != nil {
return resp.Error()
}

return nil
return resp.Error()
}

func (f *countingBloomFilter) ItemMinCount(ctx context.Context, key string) (uint, error) {
Expand Down