MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / setExecutionProfileProperties

Function setExecutionProfileProperties

lib/insights-client.js:455–485  ·  view source on GitHub ↗
(client, parent, profile, defaultProfile)

Source from the content-addressed store, hash-verified

453}
454
455function setExecutionProfileProperties(client, parent, profile, defaultProfile) {
456 const output = parent[profile.name] = {};
457 setExecutionProfileItem(output, profile, defaultProfile, 'readTimeout');
458 setExecutionProfileItem(output, profile, defaultProfile, 'loadBalancing', getPolicyInfo);
459 setExecutionProfileItem(output, profile, defaultProfile, 'retry', getPolicyInfo);
460 setExecutionProfileItem(output, profile, defaultProfile, 'consistency', getConsistencyString);
461 setExecutionProfileItem(output, profile, defaultProfile, 'serialConsistency', getConsistencyString);
462
463 if (profile === defaultProfile) {
464 // Speculative execution policy is included in the profiles as some drivers support
465 // different spec exec policy per profile, in this case is fixed for all profiles
466 output.speculativeExecution = getPolicyInfo(client.options.policies.speculativeExecution);
467 }
468
469 if (profile.graphOptions) {
470 output.graphOptions = {};
471 const defaultGraphOptions = defaultProfile.graphOptions || utils.emptyObject;
472 setExecutionProfileItem(output.graphOptions, profile.graphOptions, defaultGraphOptions, 'language');
473 setExecutionProfileItem(output.graphOptions, profile.graphOptions, defaultGraphOptions, 'name');
474 setExecutionProfileItem(output.graphOptions, profile.graphOptions, defaultGraphOptions, 'readConsistency',
475 getConsistencyString);
476 setExecutionProfileItem(output.graphOptions, profile.graphOptions, defaultGraphOptions, 'source');
477 setExecutionProfileItem(output.graphOptions, profile.graphOptions, defaultGraphOptions, 'writeConsistency',
478 getConsistencyString);
479
480 if (Object.keys(output.graphOptions).length === 0) {
481 // Properties that are undefined will not be included in the JSON
482 output.graphOptions = undefined;
483 }
484 }
485}
486
487function setExecutionProfileItem(output, profile, defaultProfile, prop, valueGetter) {
488 const value = profile[prop];

Callers 1

getExecutionProfilesFunction · 0.85

Calls 3

setExecutionProfileItemFunction · 0.85
getPolicyInfoFunction · 0.85
keysMethod · 0.65

Tested by

no test coverage detected