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 ¶
- func Coalesce(arg1 interface{}, arg2 interface{}, args ...interface{}) interface{}
- func MergeErrs(chs ...<-chan error) <-chan error
- func Noop()
- func RandString(n int) string
- func ResolveSelfIP() (net.IP, error)
- func StrPtrEq(a *string, b *string) bool
- func Uint16PtrEq(a *uint16, b *uint16) bool
- type ElasticChan
- type Semaphore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveSelfIP ¶
func StrPtrEq ¶
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 ¶
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