Documentation ¶
Overview ¶
Rendezvous (highest random weight) hashing
Package utils is a generated GoMock package.
Index ¶
- Constants
- Variables
- func InterruptSignal() <-chan os.Signal
- func NodeIpAddress() (string, error)
- func NodeUuid() (string, error)
- func ParseSeqId(znode string) (int64, error)
- func RendezvousHashScore(node, key string, weight float64) float64
- func VolatileNodeUuid() (string, error)
- func WaitUntilAllSuccessful(ctx context.Context, n int, errors chan error) error
- type Broadcast
- type ChildrenChangedEvent
- type MockZookeeper
- func (m *MockZookeeper) Children(arg0 string) ([]string, error)
- func (m *MockZookeeper) ChildrenChanges(arg0 context.Context, arg1 string) (<-chan ChildrenChangedEvent, <-chan error)
- func (m *MockZookeeper) ChildrenW(arg0 string) ([]string, <-chan zk.Event, error)
- func (m *MockZookeeper) Close()
- func (m *MockZookeeper) Create(arg0 string, arg1 []byte, arg2 int32) (string, error)
- func (m *MockZookeeper) CreatePath(arg0 string, arg1 []byte, arg2 int32) (string, error)
- func (m *MockZookeeper) CreateProtectedEphemeralSequential(arg0 string, arg1 []byte) (string, error)
- func (m *MockZookeeper) Delete(arg0 string) error
- func (m *MockZookeeper) DeleteRecursive(arg0 string) error
- func (m *MockZookeeper) EXPECT() *MockZookeeperMockRecorder
- func (m *MockZookeeper) Exists(arg0 string) (bool, error)
- func (m *MockZookeeper) ExistsW(arg0 string) (bool, <-chan zk.Event, error)
- func (m *MockZookeeper) Get(arg0 string) ([]byte, error)
- func (m *MockZookeeper) GetW(arg0 string) ([]byte, <-chan zk.Event, error)
- func (m *MockZookeeper) Multi(arg0 ...interface{}) error
- type MockZookeeperMockRecorder
- func (mr *MockZookeeperMockRecorder) Children(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) ChildrenChanges(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) ChildrenW(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) Close() *gomock.Call
- func (mr *MockZookeeperMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) CreatePath(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) CreateProtectedEphemeralSequential(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) Delete(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) DeleteRecursive(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) Exists(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) ExistsW(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) Get(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) GetW(arg0 interface{}) *gomock.Call
- func (mr *MockZookeeperMockRecorder) Multi(arg0 ...interface{}) *gomock.Call
- type PriorityQueue
- type PriorityQueueItem
- type Set
- type Stack
- type Zookeeper
- type ZookeeperConfig
Constants ¶
const ( EventZkWatchInit int32 = 0 EventZkNodeCreated int32 = 1 EventZkNodeDeleted int32 = 2 )
Variables ¶
var SeqIdRegexp = regexp.MustCompile(`\-n(\d+)`)
Functions ¶
func InterruptSignal ¶
func NodeIpAddress ¶
func ParseSeqId ¶
func RendezvousHashScore ¶
func VolatileNodeUuid ¶
Types ¶
type Broadcast ¶
type Broadcast interface { Close() Send(interface{}) Listen(int) <-chan interface{} }
func NewBroadcast ¶
func NewBroadcast() Broadcast
func NewThreadSafeBroadcast ¶
func NewThreadSafeBroadcast() Broadcast
type ChildrenChangedEvent ¶
type MockZookeeper ¶
type MockZookeeper struct {
// contains filtered or unexported fields
}
MockZookeeper is a mock of Zookeeper interface
func NewMockZookeeper ¶
func NewMockZookeeper(ctrl *gomock.Controller) *MockZookeeper
NewMockZookeeper creates a new mock instance
func (*MockZookeeper) Children ¶
func (m *MockZookeeper) Children(arg0 string) ([]string, error)
Children mocks base method
func (*MockZookeeper) ChildrenChanges ¶
func (m *MockZookeeper) ChildrenChanges(arg0 context.Context, arg1 string) (<-chan ChildrenChangedEvent, <-chan error)
ChildrenChanges mocks base method
func (*MockZookeeper) CreatePath ¶
CreatePath mocks base method
func (*MockZookeeper) CreateProtectedEphemeralSequential ¶
func (m *MockZookeeper) CreateProtectedEphemeralSequential(arg0 string, arg1 []byte) (string, error)
CreateProtectedEphemeralSequential mocks base method
func (*MockZookeeper) Delete ¶
func (m *MockZookeeper) Delete(arg0 string) error
Delete mocks base method
func (*MockZookeeper) DeleteRecursive ¶
func (m *MockZookeeper) DeleteRecursive(arg0 string) error
DeleteRecursive mocks base method
func (*MockZookeeper) EXPECT ¶
func (m *MockZookeeper) EXPECT() *MockZookeeperMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockZookeeper) Exists ¶
func (m *MockZookeeper) Exists(arg0 string) (bool, error)
Exists mocks base method
func (*MockZookeeper) Get ¶
func (m *MockZookeeper) Get(arg0 string) ([]byte, error)
Get mocks base method
func (*MockZookeeper) Multi ¶
func (m *MockZookeeper) Multi(arg0 ...interface{}) error
Multi mocks base method
type MockZookeeperMockRecorder ¶
type MockZookeeperMockRecorder struct {
// contains filtered or unexported fields
}
MockZookeeperMockRecorder is the mock recorder for MockZookeeper
func (*MockZookeeperMockRecorder) Children ¶
func (mr *MockZookeeperMockRecorder) Children(arg0 interface{}) *gomock.Call
Children indicates an expected call of Children
func (*MockZookeeperMockRecorder) ChildrenChanges ¶
func (mr *MockZookeeperMockRecorder) ChildrenChanges(arg0, arg1 interface{}) *gomock.Call
ChildrenChanges indicates an expected call of ChildrenChanges
func (*MockZookeeperMockRecorder) ChildrenW ¶
func (mr *MockZookeeperMockRecorder) ChildrenW(arg0 interface{}) *gomock.Call
ChildrenW indicates an expected call of ChildrenW
func (*MockZookeeperMockRecorder) Close ¶
func (mr *MockZookeeperMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockZookeeperMockRecorder) Create ¶
func (mr *MockZookeeperMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call
Create indicates an expected call of Create
func (*MockZookeeperMockRecorder) CreatePath ¶
func (mr *MockZookeeperMockRecorder) CreatePath(arg0, arg1, arg2 interface{}) *gomock.Call
CreatePath indicates an expected call of CreatePath
func (*MockZookeeperMockRecorder) CreateProtectedEphemeralSequential ¶
func (mr *MockZookeeperMockRecorder) CreateProtectedEphemeralSequential(arg0, arg1 interface{}) *gomock.Call
CreateProtectedEphemeralSequential indicates an expected call of CreateProtectedEphemeralSequential
func (*MockZookeeperMockRecorder) Delete ¶
func (mr *MockZookeeperMockRecorder) Delete(arg0 interface{}) *gomock.Call
Delete indicates an expected call of Delete
func (*MockZookeeperMockRecorder) DeleteRecursive ¶
func (mr *MockZookeeperMockRecorder) DeleteRecursive(arg0 interface{}) *gomock.Call
DeleteRecursive indicates an expected call of DeleteRecursive
func (*MockZookeeperMockRecorder) Exists ¶
func (mr *MockZookeeperMockRecorder) Exists(arg0 interface{}) *gomock.Call
Exists indicates an expected call of Exists
func (*MockZookeeperMockRecorder) ExistsW ¶
func (mr *MockZookeeperMockRecorder) ExistsW(arg0 interface{}) *gomock.Call
ExistsW indicates an expected call of ExistsW
func (*MockZookeeperMockRecorder) Get ¶
func (mr *MockZookeeperMockRecorder) Get(arg0 interface{}) *gomock.Call
Get indicates an expected call of Get
func (*MockZookeeperMockRecorder) GetW ¶
func (mr *MockZookeeperMockRecorder) GetW(arg0 interface{}) *gomock.Call
GetW indicates an expected call of GetW
func (*MockZookeeperMockRecorder) Multi ¶
func (mr *MockZookeeperMockRecorder) Multi(arg0 ...interface{}) *gomock.Call
Multi indicates an expected call of Multi
type PriorityQueue ¶
type PriorityQueue interface { Len() int Push(*PriorityQueueItem) Pop() *PriorityQueueItem Peek() *PriorityQueueItem Reverse() PriorityQueue ToSlice() []*PriorityQueueItem ToIterator() <-chan *PriorityQueueItem Values() []interface{} }
func NewMaxPriorityQueue ¶
func NewMaxPriorityQueue(items ...*PriorityQueueItem) PriorityQueue
func NewMinPriorityQueue ¶
func NewMinPriorityQueue(items ...*PriorityQueueItem) PriorityQueue
type PriorityQueueItem ¶
type PriorityQueueItem struct {
// contains filtered or unexported fields
}
func NewPriorityQueueItem ¶
func NewPriorityQueueItem(priority float32, value interface{}) *PriorityQueueItem
func (*PriorityQueueItem) Value ¶
func (item *PriorityQueueItem) Value() interface{}
type Set ¶
type Set interface { Len() int Clear() Add(interface{}) Remove(interface{}) Contains(interface{}) bool Equal(Set) bool Intersection(Set) Set Difference(Set) Set Union(Set) Set ToIterator() <-chan interface{} ToSlice() []interface{} String() string Rand() interface{} }
func NewThreadSafeSet ¶
func NewThreadSafeSet(elements ...interface{}) Set
type Stack ¶
type Stack interface { Len() int Push(interface{}) Pop() interface{} }
func NewThreadSafeStack ¶
func NewThreadSafeStack() Stack
type Zookeeper ¶
type Zookeeper interface { Close() Children(string) ([]string, error) ChildrenW(string) ([]string, <-chan zk.Event, error) ChildrenChanges(context.Context, string) (<-chan ChildrenChangedEvent, <-chan error) Create(string, []byte, int32) (string, error) CreateProtectedEphemeralSequential(string, []byte) (string, error) CreatePath(string, []byte, int32) (string, error) Delete(string) error DeleteRecursive(string) error Exists(string) (bool, error) ExistsW(string) (bool, <-chan zk.Event, error) Get(string) ([]byte, error) GetW(string) ([]byte, <-chan zk.Event, error) Multi(...interface{}) error }
func NewZookeeper ¶
func NewZookeeper(config ZookeeperConfig) (Zookeeper, error)
func NewZookeeperFromConn ¶
func NewZookeeperFromConn(conn *zk.Conn, config ZookeeperConfig) (Zookeeper, error)