Conn represents a connection to a kafka broker. Instances of Conn are safe to use concurrently from multiple goroutines.
| 23 | // |
| 24 | // Instances of Conn are safe to use concurrently from multiple goroutines. |
| 25 | type Conn struct { |
| 26 | // base network connection |
| 27 | conn net.Conn |
| 28 | |
| 29 | // number of inflight requests on the connection. |
| 30 | inflight int32 |
| 31 | |
| 32 | // offset management (synchronized on the mutex field) |
| 33 | mutex sync.Mutex |
| 34 | offset int64 |
| 35 | |
| 36 | // read buffer (synchronized on rlock) |
| 37 | rlock sync.Mutex |
| 38 | rbuf bufio.Reader |
| 39 | |
| 40 | // write buffer (synchronized on wlock) |
| 41 | wlock sync.Mutex |
| 42 | wbuf bufio.Writer |
| 43 | wb writeBuffer |
| 44 | |
| 45 | // deadline management |
| 46 | wdeadline connDeadline |
| 47 | rdeadline connDeadline |
| 48 | |
| 49 | // immutable values of the connection object |
| 50 | clientID string |
| 51 | topic string |
| 52 | partition int32 |
| 53 | fetchMaxBytes int32 |
| 54 | fetchMinSize int32 |
| 55 | broker int32 |
| 56 | rack string |
| 57 | |
| 58 | // correlation ID generator (synchronized on wlock) |
| 59 | correlationID int32 |
| 60 | |
| 61 | // number of replica acks required when publishing to a partition |
| 62 | requiredAcks int32 |
| 63 | |
| 64 | // lazily loaded API versions used by this connection |
| 65 | apiVersions atomic.Value // apiVersionMap |
| 66 | |
| 67 | transactionalID *string |
| 68 | } |
| 69 | |
| 70 | type apiVersionMap map[apiKey]ApiVersion |
| 71 |
nothing calls this directly
no outgoing calls
no test coverage detected