set

package
v0.2.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrConflict

type ErrConflict struct {
	Port uint
}

ErrConflict is return when trying to add a port in the set that is already present

func (ErrConflict) Error

func (e ErrConflict) Error() string

type UintSet

type UintSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

UintSet is a set containing uint

func NewUint

func NewUint(path string) *UintSet

NewUint creates a new set for uint path if the directory where to store the set on disk the directory pointed by path must exists already

func (*UintSet) Add

func (p *UintSet) Add(i uint) error

Add tries to add port to the set. If port is already present errPortConflict is return otherwise nil is returned

func (*UintSet) List

func (p *UintSet) List() ([]uint, error)

List returns a list of uint present in the set

func (*UintSet) Remove

func (p *UintSet) Remove(i uint)

Remove removes a port from the set removes never fails cause if the port is not in the set remove is a nop-op

Jump to

Keyboard shortcuts

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