Skip to content

Commit 33edd3d

Browse files
ofekshenawachayim
andauthored
Rename probablistic commands with args (#2701)
Co-authored-by: Chayim <[email protected]>
1 parent 736351c commit 33edd3d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

probabilistic.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type probabilisticCmdable interface {
2424
BFReserve(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd
2525
BFReserveExpansion(ctx context.Context, key string, errorRate float64, capacity, expansion int64) *StatusCmd
2626
BFReserveNonScaling(ctx context.Context, key string, errorRate float64, capacity int64) *StatusCmd
27-
BFReserveArgs(ctx context.Context, key string, options *BFReserveOptions) *StatusCmd
27+
BFReserveWithArgs(ctx context.Context, key string, options *BFReserveOptions) *StatusCmd
2828
BFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd
2929
BFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd
3030

@@ -38,7 +38,7 @@ type probabilisticCmdable interface {
3838
CFInsertNX(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *IntSliceCmd
3939
CFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd
4040
CFReserve(ctx context.Context, key string, capacity int64) *StatusCmd
41-
CFReserveArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd
41+
CFReserveWithArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd
4242
CFReserveExpansion(ctx context.Context, key string, capacity int64, expansion int64) *StatusCmd
4343
CFReserveBucketSize(ctx context.Context, key string, capacity int64, bucketsize int64) *StatusCmd
4444
CFReserveMaxIterations(ctx context.Context, key string, capacity int64, maxiterations int64) *StatusCmd
@@ -143,11 +143,11 @@ func (c cmdable) BFReserveNonScaling(ctx context.Context, key string, errorRate
143143
return cmd
144144
}
145145

146-
// BFReserveArgs creates an empty Bloom filter with a single sub-filter
146+
// BFReserveWithArgs creates an empty Bloom filter with a single sub-filter
147147
// for the initial specified capacity and with an upper bound error_rate.
148148
// This function also allows for specifying additional options such as expansion rate and non-scaling behavior.
149149
// For more information - https://redis.io/commands/bf.reserve/
150-
func (c cmdable) BFReserveArgs(ctx context.Context, key string, options *BFReserveOptions) *StatusCmd {
150+
func (c cmdable) BFReserveWithArgs(ctx context.Context, key string, options *BFReserveOptions) *StatusCmd {
151151
args := []interface{}{"BF.RESERVE", key}
152152
if options != nil {
153153
if options.Error != 0 {
@@ -493,10 +493,10 @@ func (c cmdable) CFReserveMaxIterations(ctx context.Context, key string, capacit
493493
return cmd
494494
}
495495

496-
// CFReserveArgs creates an empty Cuckoo filter with the specified options.
496+
// CFReserveWithArgs creates an empty Cuckoo filter with the specified options.
497497
// This function allows for specifying additional options such as bucket size and maximum number of iterations.
498498
// For more information - https://redis.io/commands/cf.reserve/
499-
func (c cmdable) CFReserveArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd {
499+
func (c cmdable) CFReserveWithArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd {
500500
args := []interface{}{"CF.RESERVE", key, options.Capacity}
501501
if options.BucketSize != 0 {
502502
args = append(args, "BUCKETSIZE", options.BucketSize)
@@ -679,7 +679,7 @@ func (c cmdable) CFInfo(ctx context.Context, key string) *CFInfoCmd {
679679
// For more information - https://redis.io/commands/cf.insert/
680680
func (c cmdable) CFInsert(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *BoolSliceCmd {
681681
args := []interface{}{"CF.INSERT", key}
682-
args = c.getCfInsertArgs(args, options, elements...)
682+
args = c.getCfInsertWithArgs(args, options, elements...)
683683

684684
cmd := NewBoolSliceCmd(ctx, args...)
685685
_ = c(ctx, cmd)
@@ -693,14 +693,14 @@ func (c cmdable) CFInsert(ctx context.Context, key string, options *CFInsertOpti
693693
// For more information - https://redis.io/commands/cf.insertnx/
694694
func (c cmdable) CFInsertNX(ctx context.Context, key string, options *CFInsertOptions, elements ...interface{}) *IntSliceCmd {
695695
args := []interface{}{"CF.INSERTNX", key}
696-
args = c.getCfInsertArgs(args, options, elements...)
696+
args = c.getCfInsertWithArgs(args, options, elements...)
697697

698698
cmd := NewIntSliceCmd(ctx, args...)
699699
_ = c(ctx, cmd)
700700
return cmd
701701
}
702702

703-
func (c cmdable) getCfInsertArgs(args []interface{}, options *CFInsertOptions, elements ...interface{}) []interface{} {
703+
func (c cmdable) getCfInsertWithArgs(args []interface{}, options *CFInsertOptions, elements ...interface{}) []interface{} {
704704
if options != nil {
705705
if options.Capacity != 0 {
706706
args = append(args, "CAPACITY", options.Capacity)

probabilistic_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,14 @@ var _ = Describe("Probabilistic commands", Label("probabilistic"), func() {
227227
Expect(infBefore).To(BeEquivalentTo(infAfter))
228228
})
229229

230-
It("should BFReserveArgs", Label("bloom", "bfreserveargs"), func() {
230+
It("should BFReserveWithArgs", Label("bloom", "bfreserveargs"), func() {
231231
options := &redis.BFReserveOptions{
232232
Capacity: 2000,
233233
Error: 0.001,
234234
Expansion: 3,
235235
NonScaling: false,
236236
}
237-
err := client.BFReserveArgs(ctx, "testbf", options).Err()
237+
err := client.BFReserveWithArgs(ctx, "testbf", options).Err()
238238
Expect(err).NotTo(HaveOccurred())
239239

240240
result, err := client.BFInfo(ctx, "testbf").Result()
@@ -352,15 +352,15 @@ var _ = Describe("Probabilistic commands", Label("probabilistic"), func() {
352352
Expect(infBefore).To(BeEquivalentTo(infAfter))
353353
})
354354

355-
It("should CFInfo and CFReserveArgs", Label("cuckoo", "cfinfo", "cfreserveargs"), func() {
355+
It("should CFInfo and CFReserveWithArgs", Label("cuckoo", "cfinfo", "cfreserveargs"), func() {
356356
args := &redis.CFReserveOptions{
357357
Capacity: 2048,
358358
BucketSize: 3,
359359
MaxIterations: 15,
360360
Expansion: 2,
361361
}
362362

363-
err := client.CFReserveArgs(ctx, "testcf1", args).Err()
363+
err := client.CFReserveWithArgs(ctx, "testcf1", args).Err()
364364
Expect(err).NotTo(HaveOccurred())
365365

366366
result, err := client.CFInfo(ctx, "testcf1").Result()

0 commit comments

Comments
 (0)