* Sets the default options that depend on the protocol version and other metadata. * @param {Client} client
(client)
| 333 | * @param {Client} client |
| 334 | */ |
| 335 | function setMetadataDependent(client) { |
| 336 | const version = client.controlConnection.protocolVersion; |
| 337 | let coreConnectionsPerHost = coreConnectionsPerHostV3; |
| 338 | let maxRequestsPerConnection = maxRequestsPerConnectionV3; |
| 339 | |
| 340 | if (!types.protocolVersion.uses2BytesStreamIds(version)) { |
| 341 | coreConnectionsPerHost = coreConnectionsPerHostV2; |
| 342 | maxRequestsPerConnection = maxRequestsPerConnectionV2; |
| 343 | } |
| 344 | |
| 345 | if (client.options.queryOptions.consistency === undefined) { |
| 346 | client.options.queryOptions.consistency = |
| 347 | client.metadata.isDbaas() ? types.consistencies.localQuorum : types.consistencies.localOne; |
| 348 | } |
| 349 | |
| 350 | client.options.pooling = utils.deepExtend( |
| 351 | {}, { coreConnectionsPerHost, maxRequestsPerConnection }, client.options.pooling); |
| 352 | } |
| 353 | |
| 354 | exports.extend = extend; |
| 355 | exports.defaultOptions = defaultOptions; |