MCPcopy
hub / github.com/segmentio/kafka-go / grabBrokerConn

Method grabBrokerConn

transport.go:644–652  ·  view source on GitHub ↗

grabBrokerConn returns a connection to a specific broker represented by the broker id passed as argument. If the broker id was not known, an error is returned.

(ctx context.Context, brokerID int32)

Source from the content-addressed store, hash-verified

642// broker id passed as argument. If the broker id was not known, an error is
643// returned.
644func (p *connPool) grabBrokerConn(ctx context.Context, brokerID int32) (*conn, error) {
645 p.mutex.RLock()
646 g := p.conns[brokerID]
647 p.mutex.RUnlock()
648 if g == nil {
649 return nil, BrokerNotAvailable
650 }
651 return g.grabConnOrConnect(ctx)
652}
653
654// grabClusterConn returns the connection to the kafka cluster that the pool is
655// configured to connect to.

Callers 1

sendRequestMethod · 0.95

Calls 1

grabConnOrConnectMethod · 0.80

Tested by

no test coverage detected