dupemap

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DupeMap

type DupeMap struct {
	// contains filtered or unexported fields
}

TODO: DupeMap should deal with value bytes.Buffer rather than pointers as it is not supposed to mutate the struct.

func NewDupeMap

func NewDupeMap(expire int64, capacity uint32) *DupeMap

NewDupeMap creates new dupemap instance. Expire is number of seconds.

func NewDupeMapDefault added in v0.4.0

func NewDupeMapDefault() *DupeMap

NewDupeMapDefault returns a dupemap instance with default config.

func (*DupeMap) HasAnywhere added in v0.4.0

func (d *DupeMap) HasAnywhere(payload *bytes.Buffer) bool

HasAnywhere tests if any of Cuckoo Filters (a filter per round) knows already this payload. Similarly to Bloom Filters, False positive matches are possible, but false negatives are not. In addition, it also resets all expired items.

func (*DupeMap) Size added in v0.4.0

func (d *DupeMap) Size() int

Size returns the bytes count allocated by the underlying filter.

type TmpMap

type TmpMap struct {
	// contains filtered or unexported fields
}

func NewTmpMap

func NewTmpMap(capacity uint32, expire int64) *TmpMap

NewTmpMap creates a TmpMap instance.

func (*TmpMap) Add

func (t *TmpMap) Add(b *bytes.Buffer) bool

Add the hash of a buffer to the blacklist. Returns true if the element was added. False otherwise.

func (*TmpMap) CleanExpired added in v0.4.0

func (t *TmpMap) CleanExpired()

CleanExpired resets all cache instances that has expired.

func (*TmpMap) Has

func (t *TmpMap) Has(b *bytes.Buffer) bool

func (*TmpMap) IsExpired added in v0.4.0

func (t *TmpMap) IsExpired() bool

IsExpired returns true if TmpMap has expired.

func (*TmpMap) Size added in v0.4.0

func (t *TmpMap) Size() int

Size returns overall size of all filters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL