Example #1
0
// NewSender returns an implementation of Sender which exposes the Key-Value
// database provided by a Cockroach cluster by connecting via RPC to a
// Cockroach node.
//
// This must not be used by server.Server or any of its components, only by
// clients talking to a Cockroach cluster through the external interface.
func NewSender(ctx *rpc.Context, target string) (Sender, error) {
	conn, err := ctx.GRPCDial(target)
	if err != nil {
		return nil, err
	}
	return sender{roachpb.NewExternalClient(conn)}, nil
}
Example #2
0
// NewSender returns an implementation of Sender which exposes the Key-Value
// database provided by a Cockroach cluster by connecting via RPC to a
// Cockroach node.
//
// This must not be used by server.Server or any of its components, only by
// clients talking to a Cockroach cluster through the external interface.
func NewSender(conn *grpc.ClientConn) Sender {
	return sender{roachpb.NewExternalClient(conn)}
}