UNPKG

@amazon-dax-sdk/client-dax

Version:

Amazon DAX Client for JavaScript

161 lines (143 loc) 5.23 kB
import { DynamoDB } from '@aws-sdk/client-dynamodb'; import { Dax } from "../src/Dax"; import { AwsCredentialIdentity, AwsCredentialIdentityProvider } from "@smithy/types"; /** * Configuration options for the DAX (DynamoDB Accelerator) JS SDK. * This configuration object is used to customize the behavior of the DAX SDK. */ export interface DaxConfig { /** * The AWS region to use for the DAX client. * This is a required parameter if not provided through the environment. * * Example: 'us-west-2', 'us-east-1'. * * @default undefined */ region?: string; /** * The endpoint of the Cluster to which SDK connects. * Example: 'dax-cluster-name.region.amazonaws.com'. * * @default undefined */ endpoint?: string; /** * Skip hostname verification of TLS connections. This has no impact on un-encrypted clusters. * The default is to perform hostname verification, setting this to True will skip verification. * Be sure you understand the implication of turning it off, which is the inability to authenticate the cluster that you are connecting to. * The value for this configuration is a Boolean, either True or False. * @default false */ skipHostnameVerification?: boolean; /** * The request timeout in milliseconds. * This defines the maximum time the client will wait for a response from DAX. * * Risks of increasing: * - Higher resource consumption due to longer-held connections * - Increased memory usage from concurrent requests * - May mask underlying performance issues * - Could impact overall application responsiveness * * Risks of decreasing: * - Operations may fail prematurely before completion * * @default 60000 (60 seconds) */ requestTimeout?: number; /** * The maximum number of retries to attempt on failed requests. * When the retry count is exceeded, the request will fail. * If readRetries / writeRetries are set, then the configuration set in "readRetries" / "writeRetries" take priority over "maxRetries". * * Retry Conditions * 1. Decoder: 'DecoderException', * 2. Unrecognized: 'UnrecognizedClientException', * 3. MalformedResult: 'MalformedResultException', * 4. EndOfStream: 'EndOfStreamException', * 5. IllegalArgument: 'IllegalArgumentException', * 6. NoRoute: 'NoRouteException', * 7. ProvisionedThroughputExceeded: 'ProvisionedThroughputExceededException', * 8. LimitExceeded: 'LimitExceededException', * 9. RequestLimitExceeded: 'RequestLimitExceeded' * 10. Throttling: 'ThrottlingException', * 11. Connection: 'ConnectionException', * @default 1 */ maxRetries?: number; /** * The number of retries to attempt for write requests that fail. * Allows fine-grained control over the retry behavior for write operations. * * @default 1 */ writeRetries?: number; /** * The number of retries to attempt for read requests that fail. * This allows fine-grained control over the retry behavior for read operations. * * @default 1 */ readRetries?: number; /** * Sets the number of consecutive errors required to signal node unhealthy within health check interval. * @default 5 */ unhealthyConsecutiveErrorCount?: number; /** * Returns the threshold below which the cluster will not be polled for membership changes. * * @default 125 */ clusterUpdateThreshold?: number; /** * Returns the interval between polling of cluster members for membership changes. * * @default 4000 */ clusterUpdateInterval?: number; /** * The timeout (in milliseconds) for establishing a connection to any of the cluster nodes. * * @default 10000 */ connectTimeout?: number; /** * The interval (in milliseconds) between cluster health checks. A lower interval will check more frequently. * * @default 5000 */ healthCheckInterval?: number; /** * The timeout (in milliseconds) for the health check to complete. * * @default 1000 */ healthCheckTimeout?: number; /** * The maximum delay (in milliseconds) for retry attempts when a request fails. * * @default 7000 */ maxRetryDelay?: number; /** * The AWS credentials to use for authenticating requests. * This can be provided as an `AwsCredentialIdentity` or an `AwsCredentialIdentityProvider`. * If not provided, the AWS SDK will automatically use the default credentials provider chain. * * Example: `{ accessKeyId: 'AKIA...', secretAccessKey: '...', sessionToken: '...' }` * * @default Uses default AWS credentials provider chain. */ credentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider; } export declare class Dax extends DynamoDB { /** * Creates an instance of the Cluster class. * * @param config The configuration options for the Dax Client. * @param cluster Cluster Object (Optional) */ constructor(config: DaxConfig, cluster?: any); }