Documentation ¶
Index ¶
- Constants
- type Actor
- type Actors
- type Cluster
- func (n *Cluster) DeregisterEventHandler(fn members.EventHandler) error
- func (n *Cluster) Read(key selectors.Key, quorum selectors.Quorum) (nodes []nodes.Node)
- func (n *Cluster) RegisterEventHandler(fn members.EventHandler) error
- func (n *Cluster) Run() error
- func (n *Cluster) Stop()
- func (n *Cluster) Write(key selectors.Key, quorum selectors.Quorum) ([]nodes.Node, func([]uint32) error)
- type ClusterEventHandler
- type HashRing
- type NodeStrategy
- type Snapshot
Constants ¶
const BloomEventType = "bloom"
BloomEventType is a event type where the underlying bloom filter is broadcast to other nodes, to help improve the hashring.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
Actor represents a way to communicate to a node in the cluster. The actor also has some knowledge of a potential key living inside the underlying store.
func NewActor ¶
func NewActor(strategy NodeStrategy) *Actor
NewActor creates a Actor with the correct Transport for communicating to the various end point.
func (*Actor) Add ¶
Add adds a known piece of data to the actor to improve the potential of finding the data with in the store. Consider this as a Hint to improve various consensus algorithms.
func (*Actor) Contains ¶
Contains checks to see if there is any potential data in the underlying store.
type Actors ¶
type Actors struct {
// contains filtered or unexported fields
}
Actors is a collection of the Actor Node allowing accessing the actor via the host or via a hash.
func (*Actors) Get ¶
Get returns a the Actor according to the hash of the node Returns the ok if the node is found.
func (*Actors) Set ¶
Set adds a Actor to the nodes according to the address hash If a hash already exists, then it will over write the existing hash value
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster represents a set of nodes with in the cluster
func NewCluster ¶
func NewCluster(peer cluster.Peer, transport api.TransportStrategy, replicationFactor int, localAPIAddr string, logger log.Logger, ) *Cluster
NewCluster creates a Cluster with the correct dependencies
func (*Cluster) DeregisterEventHandler ¶
func (n *Cluster) DeregisterEventHandler(fn members.EventHandler) error
DeregisterEventHandler removes feed back from the underlying peers
func (*Cluster) Read ¶
Read returns a set of nodes in a specific time. Nodes which are used from the Read are not guaranteed to succeed for longer than their purpose. It is not recommended to store the nodes locally as they may not be the same nodes over time.
func (*Cluster) RegisterEventHandler ¶
func (n *Cluster) RegisterEventHandler(fn members.EventHandler) error
RegisterEventHandler gives feed back from the underlying peers
type ClusterEventHandler ¶
type ClusterEventHandler struct {
// contains filtered or unexported fields
}
ClusterEventHandler holds a reference to the cluster so that we can effectively deal with the events comming in from the cluster.
func (ClusterEventHandler) HandleEvent ¶
func (h ClusterEventHandler) HandleEvent(e members.Event) error
HandleEvent handles the member events comming from the cluster.
type HashRing ¶
type HashRing struct {
// contains filtered or unexported fields
}
HashRing stores strings on a consistent hash ring. HashRing internally uses Red-Black Tree to achieve O(log N) lookup and insertion time.
func NewHashRing ¶
NewHashRing creates a new HashRing with a replication factor
func (*HashRing) Add ¶
Add a host and replicates it around the hashring according to the replication factor. Returns true if an insertion happens for all replicated points
func (*HashRing) Contains ¶
Contains checks to see if a key is already in the ring. Returns true if a key is found with in the ring.
type NodeStrategy ¶
type Snapshot ¶
type Snapshot interface { // Write returns a set of nodes for a specific time. Nodes which are // used from the Read Snapshot are not guaranteed to succeed for longer than // their purpose. // It is not recommended to store the nodes locally as they may not be the same // nodes over time. // The function commits the values to the blooms once they've been written Write(selectors.Key, selectors.Quorum) ([]nodes.Node, func([]uint32) error) // Read returns a set of nodes for a specific time. Nodes which are // used from the Read Snapshot are not guaranteed to succeed for longer than // their purpose. // It is not recommended to store the nodes locally as they may not be the same // nodes over time. Read(selectors.Key, selectors.Quorum) []nodes.Node }
Snapshot defines a way to snapshot a series of nodes at a specific time.