Documentation ¶
Index ¶
- type ErrNodeNotFound
- type Location
- type Node
- func (n *Node) Addr() string
- func (n *Node) Get(rangeID api.RangeID) (api.RangeInfo, bool)
- func (n *Node) HasRange(rID api.RangeID) bool
- func (n *Node) Ident() api.NodeID
- func (n *Node) IsGoneFromServiceDiscovery(now time.Time) bool
- func (n *Node) IsMissing(expireDuration time.Duration, now time.Time) bool
- func (n *Node) PlacementFailed(rID api.RangeID, t time.Time)
- func (n *Node) PlacementFailures(rID api.RangeID, after time.Time) int
- func (n *Node) String() string
- func (n *Node) TestString() string
- func (n *Node) UpdateRangeInfo(ri *api.RangeInfo)
- func (n *Node) UpdateRangeState(rID api.RangeID, s api.RemoteState) error
- func (n *Node) Utilization() uint8
- func (n *Node) WantDrain() bool
- type NodeGetter
- type NodeInfo
- type PlacementFailure
- type Roster
- func (r *Roster) Candidate(rng *ranje.Range, c ranje.Constraint) (api.NodeID, error)
- func (ros *Roster) Discover()
- func (ros *Roster) Locate(k api.Key) []Location
- func (ros *Roster) LocateInState(k api.Key, states []api.RemoteState) []Location
- func (ros *Roster) NodeByIdent(nID api.NodeID) (*Node, error)
- func (r *Roster) Run(t *time.Ticker)
- func (ros *Roster) TestString() string
- func (r *Roster) Tick()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrNodeNotFound ¶
ErrNodeNotFound is returned by NodeGetter implementations when NodeByIdent is called with a node which does not exist.
func (ErrNodeNotFound) Error ¶
func (e ErrNodeNotFound) Error() string
type Node ¶
type Node struct { Remote api.Remote Client pb.NodeClient // contains filtered or unexported fields }
func (*Node) IsGoneFromServiceDiscovery ¶
func (*Node) IsMissing ¶
IsMissing returns true if this node hasn't responded to a probe in long enough that we think it's dead, and should move its ranges elsewhere.
func (*Node) PlacementFailures ¶
func (*Node) TestString ¶
TODO: This is only used by tests. Maybe move it there?
func (*Node) UpdateRangeInfo ¶
func (*Node) UpdateRangeState ¶
func (*Node) Utilization ¶
Utilization returns a uint in [0, 255], indicating how busy this node is. Ranges should generally be placed on nodes with lower utilization.
type NodeGetter ¶
NodeGetter allows callers to get a Node from its NodeIdent.
type PlacementFailure ¶
type PlacementFailure struct {
// contains filtered or unexported fields
}
type Roster ¶
type Roster struct { // How long should the controller wait for a node to respond to a probe // before expiring it? The default value (zero) means that nodes expire as // soon as they are discovered, which means that nothing every works. That // is non-ideal. NodeExpireDuration time.Duration // TODO: Can this be private now? Nodes map[api.NodeID]*Node sync.RWMutex // To be stubbed when testing. NodeConnFactory func(ctx context.Context, remote api.Remote) (*grpc.ClientConn, error) // contains filtered or unexported fields }
func (*Roster) Candidate ¶
Candidate returns the NodeIdent of a node which could accept the given range.
TODO: Instead of an actual range, this should take a "pseudo-range" which is either a single range (wanting to split) and split point, or two ranges (wanting to join). Or I guess just a wrapper around a single (moving) range. From these, we can estimate how much capacity the candidate node(s) will need, allowing us to find candidates before actually performing splits and joins.
func (*Roster) Locate ¶
Locate returns the list of node IDs that the given key can be found on, and the state of the range containing the key.
func (*Roster) LocateInState ¶
func (*Roster) Run ¶
TODO: Need some way to gracefully stop! Have to close the info channel to stop the reconciler.
func (*Roster) TestString ¶
TODO: This is only used by tests. Maybe move it there?