-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
ConnectionPolicy.ts
36 lines (35 loc) · 1.4 KB
/
ConnectionPolicy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { RetryOptions } from "../retry/retryOptions";
import { ConnectionMode } from "./ConnectionMode";
/**
* Represents the Connection policy associated with a CosmosClient in the Azure Cosmos DB database service.
*/
export interface ConnectionPolicy {
/** Determines which mode to connect to Cosmos with. (Currently only supports Gateway option) */
connectionMode?: ConnectionMode;
/** Request timeout (time to wait for response from network peer). Represented in milliseconds. */
requestTimeout?: number;
/** Flag to enable/disable automatic redirecting of requests based on read/write operations. */
enableEndpointDiscovery?: boolean;
/** List of azure regions to be used as preferred locations for read requests. */
preferredLocations?: string[];
/** RetryOptions object which defines several configurable properties used during retry. */
retryOptions?: RetryOptions;
/**
* The flag that enables writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service.
* Default is `false`.
*/
useMultipleWriteLocations?: boolean;
}
/**
* @ignore
*/
export const defaultConnectionPolicy = Object.freeze({
connectionMode: ConnectionMode.Gateway,
requestTimeout: 60000,
enableEndpointDiscovery: true,
preferredLocations: [],
retryOptions: {},
useMultipleWriteLocations: true
});