CosmosDbPartitionedStorage class

Cosmos DB partitioned storage provider.

This class implements the legacy CosmosDbPartitionedStorage contract. Use CosmosDbPartitionedStorageV2 for the structured StorageV2 contract.

Extends

CosmosDbPartitionedStorageInternals

Constructors

CosmosDbPartitionedStorage(CosmosDbPartitionedStorageOptions)

Initializes a new instance of the CosmosDbPartitionedStorage class.

Inherited Properties

compatibilityModePartitionKey
container
cosmosDbStorageOptions
length

The number of items in the storage. This property is not currently used.

Methods

delete(string[])

Deletes legacy items and ignores missing documents.

read(string[])

Reads legacy items and attaches Cosmos DB ETags as eTag values.

write(StoreItems)

Writes legacy items and applies eTag concurrency checks.

Constructor Details

CosmosDbPartitionedStorage(CosmosDbPartitionedStorageOptions)

Initializes a new instance of the CosmosDbPartitionedStorage class.

new CosmosDbPartitionedStorage(cosmosDbStorageOptions: CosmosDbPartitionedStorageOptions)

Parameters

cosmosDbStorageOptions
CosmosDbPartitionedStorageOptions

The options for configuring Cosmos DB partitioned storage.

Inherited Property Details

compatibilityModePartitionKey

compatibilityModePartitionKey: boolean

Property Value

boolean

Inherited From CosmosDbPartitionedStorageInternals.compatibilityModePartitionKey

container

container: Container

Property Value

Inherited From CosmosDbPartitionedStorageInternals.container

cosmosDbStorageOptions

cosmosDbStorageOptions: CosmosDbPartitionedStorageOptions

Property Value

Inherited From CosmosDbPartitionedStorageInternals.cosmosDbStorageOptions

length

The number of items in the storage. This property is not currently used.

length: number

Property Value

number

Inherited From CosmosDbPartitionedStorageInternals.length

Method Details

delete(string[])

Deletes legacy items and ignores missing documents.

function delete(keys: string[]): Promise<void>

Parameters

keys

string[]

The keys to delete.

Returns

Promise<void>

read(string[])

Reads legacy items and attaches Cosmos DB ETags as eTag values.

function read(keys: string[]): Promise<StoreItems>

Parameters

keys

string[]

The keys to read.

Returns

Promise<StoreItems>

The stored items; missing keys are omitted.

write(StoreItems)

Writes legacy items and applies eTag concurrency checks.

function write(changes: StoreItems): Promise<void>

Parameters

changes
StoreItems

The keyed legacy items to write.

Returns

Promise<void>

Inherited Method Details

checkForNestingError(object, string | Error | Record<"message", string>)

function checkForNestingError(json: object, err: string | Error | Record<"message", string>)

Parameters

json

object

err

string | Error | Record<"message", string>

Inherited From CosmosDbPartitionedStorageInternals.checkForNestingError

getPartitionKey(string)

function getPartitionKey(key: string): string | undefined

Parameters

key

string

Returns

string | undefined

Inherited From CosmosDbPartitionedStorageInternals.getPartitionKey

initialize()

Initializes the Cosmos DB container.

function initialize(): Promise<void>

Returns

Promise<void>

Inherited From CosmosDbPartitionedStorageInternals.initialize

isExpired(DocumentStoreItem)

function isExpired(item: DocumentStoreItem): boolean

Parameters

item

DocumentStoreItem

Returns

boolean

Inherited From CosmosDbPartitionedStorageInternals.isExpired