set

package
v0.0.0-...-682d07f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

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

Set contains a collection of data elements stored in a hash set. All exported methods manipulating the hash set in Set are concurrency safe.

func New

func New() *Set

New creates a new data container

func (*Set) Add

func (set *Set) Add(item section.Hasher) bool

Add adds item to the hash set. This method is concurrency safe. Add returns false if item could not be added to the hash set as it is in the process of being deleted.

func (*Set) Delete

func (set *Set) Delete(item section.Hasher) bool

Delete removes item from the hash set if it is contained. This method is concurrency safe. Returns true if item was contained

func (*Set) GetAll

func (set *Set) GetAll() []section.Hasher

GetAll returns a slice of all elements contained in the hash set. If the hash set is in the process of being deleted GetAll return an empty slice

func (*Set) GetAllAndDelete

func (set *Set) GetAllAndDelete() []section.Hasher

GetAllAndDelete returns a slice of all elements contained in the hash set and sets the isDeleted flag such that no methods will access this hash set anymore in the future. If the hash set is already in the process of being deleted GetAllAndDelete return an empty slice.

func (*Set) Len

func (set *Set) Len() int

Len 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