Documentation
¶
Index ¶
- Variables
- type PeerQueue
- func (pq *PeerQueue) ActorType() string
- func (pq *PeerQueue) Dead(peer string)
- func (pq *PeerQueue) IsOptimisticallyRegistered(actor string) bool
- func (pq *PeerQueue) IsRegistered(actor string) bool
- func (pq *PeerQueue) IsRequired(actor string) bool
- func (pq *PeerQueue) Live(peer string)
- func (pq *PeerQueue) MaxAssigned() (string, error)
- func (pq *PeerQueue) MinAssigned() (string, error)
- func (pq *PeerQueue) Missing() []*grid.ActorStart
- func (pq *PeerQueue) NumOptimisticallyRegistered() int
- func (pq *PeerQueue) NumOptimisticallyRegisteredOn(peer string) int
- func (pq *PeerQueue) NumRegistered() int
- func (pq *PeerQueue) NumRegisteredOn(peer string) int
- func (pq *PeerQueue) OptimisticallyDead(peer string)
- func (pq *PeerQueue) OptimisticallyLive(peer string)
- func (pq *PeerQueue) OptimisticallyRegister(actor, peer string)
- func (pq *PeerQueue) OptimisticallyUnregister(actor string)
- func (pq *PeerQueue) Peers() map[string]struct{}
- func (pq *PeerQueue) Register(actor, peer string)
- func (pq *PeerQueue) Relocate() *RelocationPlan
- func (pq *PeerQueue) Required() []string
- func (pq *PeerQueue) SetRequired(def *grid.ActorStart) error
- func (pq *PeerQueue) Unregister(actor string)
- func (pq *PeerQueue) UnsetRequired(actor string)
- type RelocationPlan
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmpty = errors.New("empty") ErrActorTypeMismatch = errors.New("actor type mismatch") )
Functions ¶
This section is empty.
Types ¶
type PeerQueue ¶
type PeerQueue struct {
// contains filtered or unexported fields
}
func (*PeerQueue) IsOptimisticallyRegistered ¶
IsOptimisticallyRegistered returns true if the actor has been optimistically registered.
func (*PeerQueue) IsRegistered ¶
IsRegistered returns true if the actor has been registered.
func (*PeerQueue) MaxAssigned ¶
MaxAssigned returns the "next" living peer that has the most actors registered.
func (*PeerQueue) MinAssigned ¶
MinAssigned returns the "next" living peer that has the least actors registered.
func (*PeerQueue) Missing ¶
func (pq *PeerQueue) Missing() []*grid.ActorStart
Missing actors that are required but not registered.
func (*PeerQueue) NumOptimisticallyRegistered ¶
NumOptimisticallyRegistered returns the current number of actors optimistically registered.
func (*PeerQueue) NumOptimisticallyRegisteredOn ¶
NumOptimisticallyRegisteredOn the peer.
func (*PeerQueue) NumRegistered ¶
NumRegistered returns the current number of actors registered.
func (*PeerQueue) NumRegisteredOn ¶
NumRegisteredOn the peer.
func (*PeerQueue) OptimisticallyDead ¶
OptimisticallyDead until a real event marks the peer alive again.
func (*PeerQueue) OptimisticallyLive ¶
OptimisticallyLive until an event marks the peer dead.
func (*PeerQueue) OptimisticallyRegister ¶
OptimisticallyRegister an actor, ie: no confirmation has arrived that the actor is actually running the the peer, but it has been requested to run on the peer.
func (*PeerQueue) OptimisticallyUnregister ¶
OptimisticallyUnregister the actor, ie: no confirmation has arrived that the actor is NOT running on the peer, but perhaps because of a failed request to the peer to start the actor it is known that likely the actor is not running.
func (*PeerQueue) Relocate ¶
func (pq *PeerQueue) Relocate() *RelocationPlan
Relocate actors from peers that have an unfair number of actors, where unfair is defined as the integer ceiling of the average.
func (*PeerQueue) SetRequired ¶
func (pq *PeerQueue) SetRequired(def *grid.ActorStart) error
SetRequired flag on actor. If it's type does not match the type of previously set actors an error is returned.
func (*PeerQueue) Unregister ¶
Unregister the actor from its current peer.
func (*PeerQueue) UnsetRequired ¶
UnsetRequired flag on actor.
type RelocationPlan ¶
type RelocationPlan struct { ActorType string Total int Average int Peers []string Count map[string]int Burden map[string]int Relocations []*grid.ActorStart }
func NewRelocationPlan ¶
func NewRelocationPlan(actorType string, total, average int) *RelocationPlan
func (*RelocationPlan) String ¶
func (p *RelocationPlan) String() string