Documentation ¶
Index ¶
- Variables
- func IsCompareAndSwapFailure(err error) bool
- func IsKeyNotFound(err error) bool
- func IsNodeExists(err error) bool
- func NextId() (uint64, error)
- func TTLRefreshDur(nodettl time.Duration) time.Duration
- func WgCount(wg *DistributedWaitGroup) (int, error)
- type CounterUpdate
- type DistributedCounter
- type DistributedWaitGroup
- type EtcdPubSubTopic
- type Leadership
- type NodeKeepAlive
- type TopicMsg
- type Topology
Constants ¶
This section is empty.
Variables ¶
var CASErrorOutOfRetries error = fmt.Errorf("error trying to do a compare and swap of a value. out of retries.")
var DefaultTTL time.Duration = 24 * time.Hour
var UseDebugdlogging = false
LOGGING
var Usedtracedlogging = false
Functions ¶
func IsCompareAndSwapFailure ¶
func IsKeyNotFound ¶
func IsNodeExists ¶
func WgCount ¶
func WgCount(wg *DistributedWaitGroup) (int, error)
WgCount is a helper function to extract the number of workers this waitgroup is currently waiting on. useful for tests that aren't exiting.
Types ¶
type CounterUpdate ¶
type DistributedCounter ¶
type DistributedCounter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewDistributedCounter ¶
func (*DistributedCounter) Dec ¶
func (c *DistributedCounter) Dec(n int) error
func (*DistributedCounter) Inc ¶
func (c *DistributedCounter) Inc(n int) error
func (*DistributedCounter) Set ¶
func (c *DistributedCounter) Set(val int) error
func (*DistributedCounter) UnWatch ¶
func (c *DistributedCounter) UnWatch()
func (*DistributedCounter) Val ¶
func (c *DistributedCounter) Val() (int, error)
type DistributedWaitGroup ¶
type DistributedWaitGroup struct {
// contains filtered or unexported fields
}
func NewDistributedWaitGroup ¶
func NewWaitGroup ¶
func (*DistributedWaitGroup) Add ¶
func (wg *DistributedWaitGroup) Add(delta int) error
Add adds an expected number of works to wait on.
func (*DistributedWaitGroup) Done ¶
func (wg *DistributedWaitGroup) Done() error
Done signals the parent that this workers has finished.
func (*DistributedWaitGroup) Wait ¶
func (wg *DistributedWaitGroup) Wait() error
Wait will block until all workers have called Done().
WARNING: There aren't currently any guards in place to prevent other actors from calling Add() after the parent calls Wait(). This differs from the behavior of the sync.WaitGroup, which doesn't allow you to add workers after calling Wait(). So be careful...
type EtcdPubSubTopic ¶
type EtcdPubSubTopic struct {
// contains filtered or unexported fields
}
func NewPubSubTopic ¶
NewPubSubTopic uses Etcd as a pub/sub message broker. Not really the best application for Etcd, as the overhead of raft consensus is expensive. So don't expect to use this to send thousands of messages a second. I've only used it as a low volume message bus, in projects were I wanted to limit the number of technologies involved.
func NewPubSubTopicByKey ¶
func (*EtcdPubSubTopic) Publish ¶
func (t *EtcdPubSubTopic) Publish(msg []byte) error
func (*EtcdPubSubTopic) Subscribe ¶
func (t *EtcdPubSubTopic) Subscribe() (<-chan *TopicMsg, error)
func (*EtcdPubSubTopic) UnSubscribe ¶
func (t *EtcdPubSubTopic) UnSubscribe()
type Leadership ¶
type Leadership struct {
// contains filtered or unexported fields
}
func NewLeaderElection ¶
type NodeKeepAlive ¶
type NodeKeepAlive struct {
// contains filtered or unexported fields
}
func NewNodeKeepAlive ¶
func (*NodeKeepAlive) Stop ¶
func (k *NodeKeepAlive) Stop()