Skip to content

Commit aac5a1b

Browse files
committed
2 parents 0a29e1e + fca2f5c commit aac5a1b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cuckoo Filter
22

3-
[![GoDoc](https://godoc.org/github.com/seiflotfy/cuckoofilter?status.svg)](https://godoc.org/github.com/seiflotfy/cuckoofilter) [![CodeHunt.io](https://img.shields.io/badge/vote-codehunt.io-02AFD1.svg)](http://codehunt.io/sub/cuckoo-filter/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
3+
[![GoDoc](https://godoc.org/github.com/seiflotfy/cuckoofilter?status.svg)](https://godoc.org/github.com/seiflotfy/cuckoofilter) [![CodeHunt.io](https://img.shields.io/badge/vote-codehunt.io-02AFD1.svg)](http://codehunt.io/sub/cuckoo-filter/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
44

55
Cuckoo filter is a Bloom filter replacement for approximated set-membership queries. While Bloom filters are well-known space-efficient data structures to serve queries like "if item x is in a set?", they do not support deletion. Their variances to enable deletion (like counting Bloom filters) usually require much more space.
66

@@ -24,19 +24,19 @@ cf.InsertUnique([]byte{"geeky ogre"})
2424
// Lookup a string (and it a miss) if it exists in the cuckoofilter
2525
cf.Lookup([]byte{"hello"})
2626

27-
count := cf.GetCount()
27+
count := cf.Count()
2828
// count == 1
2929

3030
// Delete a string (and it a miss)
3131
cf.Delete([]byte{"hello"})
3232

33-
count := cf.GetCount()
33+
count := cf.Count()
3434
// count == 1
3535

3636
// Delete a string (a hit)
3737
cf.Delete([]byte{"geeky ogre"})
3838

39-
count := cf.GetCount()
39+
count := cf.Count()
4040
// count == 0
4141
```
4242

cuckoofilter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ func (cf *CuckooFilter) delete(fp fingerprint, i uint) bool {
107107
/*
108108
GetCount returns the number of items in the counter
109109
*/
110-
func (cf *CuckooFilter) GetCount() uint {
110+
func (cf *CuckooFilter) Count() uint {
111111
return cf.count
112112
}

cuckoofilter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestInsertion(t *testing.T) {
2525
values = append(values, s)
2626
}
2727

28-
count := cf.GetCount()
28+
count := cf.Count()
2929
if count != 235081 {
3030
t.Errorf("Expected count = 235081, instead count = %d", count)
3131
}
@@ -34,7 +34,7 @@ func TestInsertion(t *testing.T) {
3434
cf.Delete(v)
3535
}
3636

37-
count = cf.GetCount()
37+
count = cf.Count()
3838
if count != 0 {
3939
t.Errorf("Expected count = 0, instead count == %d", count)
4040
}

0 commit comments

Comments
 (0)