utils

package
v3.3.12 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: BSD-2-Clause Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStatePath = errors.New("Invalid state file path")
	ErrNoState          = errors.New("No state available")
)

Functions

func GetQuitChannel added in v3.3.3

func GetQuitChannel() chan os.Signal

GetQuitChannel registers and returns a channel that will be notified upon receipt of the following signals: SIGHUP, SIGINT, SIGQUIT, SIGTERM

func ParseInt

func ParseInt(v string) (r uint64, err error)

func ParseSource

func ParseSource(v string) (ret net.IP, err error)

ParseSource attempts to parse a string as a source override The priority logic is:

  1. IP address
  2. Numeric ID
  3. hexadecimal hash

func WaitForQuit added in v3.3.3

func WaitForQuit() (r os.Signal)

WaitForQuit waits until it receives one of the following signals: SIGHUP, SIGINT, SIGQUIT, SIGTERM It returns the received signal.

Types

type ReadResetCloser added in v3.3.6

type ReadResetCloser interface {
	Read([]byte) (int, error)
	Close() error
	Reset() error
}

func GetReader added in v3.3.6

func GetReader(fin *os.File, tp types.Type) (r ReadResetCloser, err error)

func NewFileReadResetCloser added in v3.3.6

func NewFileReadResetCloser(fin *os.File) ReadResetCloser

func OpenBufferedFileReader

func OpenBufferedFileReader(p string, buffer int) (r ReadResetCloser, err error)

func OpenFileReader

func OpenFileReader(p string) (r ReadResetCloser, err error)

type State added in v3.3.1

type State struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewState added in v3.3.1

func NewState(pth string, perm os.FileMode) (s *State, err error)

func (*State) Read added in v3.3.1

func (s *State) Read(f interface{}) (err error)

func (*State) Write added in v3.3.1

func (s *State) Write(f interface{}) (err error)

Jump to

Keyboard shortcuts

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