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

Method negotiateVersion

conn.go:205–215  ·  view source on GitHub ↗
(key apiKey, sortedSupportedVersions ...apiVersion)

Source from the content-addressed store, hash-verified

203}
204
205func (c *Conn) negotiateVersion(key apiKey, sortedSupportedVersions ...apiVersion) (apiVersion, error) {
206 v, err := c.loadVersions()
207 if err != nil {
208 return -1, err
209 }
210 a := v.negotiate(key, sortedSupportedVersions...)
211 if a < 0 {
212 return -1, fmt.Errorf("no matching versions were found between the client and the broker for API key %d", key)
213 }
214 return a, nil
215}
216
217func (c *Conn) loadVersions() (apiVersionMap, error) {
218 v, _ := c.apiVersions.Load().(apiVersionMap)

Callers 8

joinGroupMethod · 0.95
ReadBatchWithMethod · 0.95
ReadPartitionsMethod · 0.95
saslHandshakeMethod · 0.95
saslAuthenticateMethod · 0.95
deleteTopicsMethod · 0.95
createTopicsMethod · 0.95

Calls 2

loadVersionsMethod · 0.95
negotiateMethod · 0.80

Tested by

no test coverage detected