util

package
v0.0.0-...-2406947 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek

Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek

Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Coalesce

func Coalesce(arg1 interface{}, arg2 interface{}, args ...interface{}) interface{}

func MergeErrs

func MergeErrs(chs ...<-chan error) <-chan error

func Noop

func Noop()

func ResolveSelfIP

func ResolveSelfIP() (net.IP, error)

func StrPtrEq

func StrPtrEq(a *string, b *string) bool

Check two string pointers for equality as follows: - If neither pointer is nil, check equality of the underlying strings. - If either pointer is nil, return true if and only if they both are.

func Uint16PtrEq

func Uint16PtrEq(a *uint16, b *uint16) bool

Check two uint16 pointers for equality as follows: - If neither pointer is nil, check equality of the underlying uint16s. - If either pointer is nil, return true if and only if they both are.

Types

type ElasticChan

type ElasticChan struct {
	In  chan interface{}
	Out chan interface{}
	// contains filtered or unexported fields
}

A dynamic channel that does not block on send, but has an unlimited buffer capacity. ElasticChan uses a dynamic slice to buffer signals received on the input channel until the output channel is ready to process them.

func (*ElasticChan) Init

func (c *ElasticChan) Init()

Initialise the Elastic channel, and start the management goroutine.

func (*ElasticChan) Log

func (c *ElasticChan) Log() log.Logger

func (*ElasticChan) Run

func (c *ElasticChan) Run()

func (*ElasticChan) SetLog

func (c *ElasticChan) SetLog(logger log.Logger)

func (*ElasticChan) Stop

func (c *ElasticChan) Stop()

type Semaphore

type Semaphore interface {
	// Take a semaphore lock.
	Acquire()

	// Release an acquired semaphore lock.
	// This should only be called when the semaphore is blocked, otherwise behaviour is undefined
	Release()

	// Block execution until the semaphore is free.
	Wait()

	// Clean up the semaphore object.
	Dispose()
}

Simple semaphore implementation. Any number of calls to Acquire() can be made; these will not block. If the semaphore has been acquired more times than it has been released, it is called 'blocked'. Otherwise, it is called 'free'.

func NewSemaphore

func NewSemaphore() Semaphore

Jump to

Keyboard shortcuts

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