hashset

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeSet added in v0.4.0

type SafeSet struct {
	sync.RWMutex
	*Set
}

SafeSet is a threadsafe hashset.

func NewSafe added in v0.4.0

func NewSafe() *SafeSet

NewSafe returns an initialized SafeSet.

func (*SafeSet) Add added in v0.4.0

func (s *SafeSet) Add(data []byte) bool

Add an entry to the current set. If the entry is already there, it returns true.

func (*SafeSet) Has added in v0.4.0

func (s *SafeSet) Has(data []byte) bool

Has returns true if the entry is found.

func (*SafeSet) Remove added in v0.4.0

func (s *SafeSet) Remove(data []byte) bool

Remove returns the number of elements in the SafeSet.

func (*SafeSet) Size added in v0.4.0

func (s *SafeSet) Size() int

Size returns the number of elements in the SafeSet.

type Set

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

Set is a hashset implementation. The hashing function is Xxhash for its high performance.

func New

func New() *Set

New creates a new Set.

func (*Set) Add

func (s *Set) Add(data []byte) bool

Add an entry to the current set. If the entry is already there, it returns true.

func (*Set) Has

func (s *Set) Has(data []byte) bool

Has returns true if the entry is found.

func (*Set) Remove added in v0.4.0

func (s *Set) Remove(data []byte) bool

Remove an entry from the set. Returns true if the entry was found. False otherwise.

func (*Set) Size

func (s *Set) Size() int

Size returns the number of elements in the Set.

Jump to

Keyboard shortcuts

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