cockroach: Index | Files

package nodedialer

import ""


Package Files


type AddressResolver Uses

type AddressResolver func(roachpb.NodeID) (net.Addr, error)

An AddressResolver translates NodeIDs into addresses.

type Dialer Uses

type Dialer struct {
    // contains filtered or unexported fields

A Dialer wraps an *rpc.Context for dialing based on node IDs. For each node, it maintains a circuit breaker that prevents rapid connection attempts and provides hints to the callers on whether to log the outcome of the operation.

func New Uses

func New(rpcContext *rpc.Context, resolver AddressResolver) *Dialer

New initializes a Dialer.

func (*Dialer) CTDialer Uses

func (n *Dialer) CTDialer() closedts.Dialer

CTDialer wraps the NodeDialer into a closedts.Dialer.

func (*Dialer) ConnHealth Uses

func (n *Dialer) ConnHealth(nodeID roachpb.NodeID, class rpc.ConnectionClass) error

ConnHealth returns nil if we have an open connection of the request class to the given node that succeeded on its most recent heartbeat. See the method of the same name on rpc.Context for more details.

func (*Dialer) Dial Uses

func (n *Dialer) Dial(
    ctx context.Context, nodeID roachpb.NodeID, class rpc.ConnectionClass,
) (_ *grpc.ClientConn, err error)

Dial returns a grpc connection to the given node. It logs whenever the node first becomes unreachable or reachable.

func (*Dialer) DialInternalClient Uses

func (n *Dialer) DialInternalClient(
    ctx context.Context, nodeID roachpb.NodeID, class rpc.ConnectionClass,
) (context.Context, roachpb.InternalClient, error)

DialInternalClient is a specialization of DialClass for callers that want a roachpb.InternalClient. This supports an optimization to bypass the network for the local node. Returns a context.Context which should be used when making RPC calls on the returned server. (This context is annotated to mark this request as in-process and bypass ctx.Peer checks).

func (*Dialer) DialNoBreaker Uses

func (n *Dialer) DialNoBreaker(
    ctx context.Context, nodeID roachpb.NodeID, class rpc.ConnectionClass,
) (_ *grpc.ClientConn, err error)

DialNoBreaker ignores the breaker if there is an error dialing. This function should only be used when there is good reason to believe that the node is reachable.

func (*Dialer) GetCircuitBreaker Uses

func (n *Dialer) GetCircuitBreaker(
    nodeID roachpb.NodeID, class rpc.ConnectionClass,
) *circuit.Breaker

GetCircuitBreaker retrieves the circuit breaker for connections to the given node. The breaker should not be mutated as this affects all connections dialing to that node through this NodeDialer.

func (*Dialer) Stopper Uses

func (n *Dialer) Stopper() *stop.Stopper

Stopper returns this node dialer's Stopper. TODO(bdarnell): This is a bit of a hack for kv/transport_race.go

Package nodedialer imports 16 packages (graph) and is imported by 35 packages. Updated 2020-08-05. Refresh now. Tools for package owners.