Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,17 @@ public CosmosContainerProperties setDefaultTimeToLiveInSeconds(Integer timeToLiv
}

/**
* Sets the analytical storage time to live in seconds for items in a container from the Azure Cosmos DB service.
* Sets the analytical store time to live in seconds for items in a container from the Azure Cosmos DB service.
*
* It is an optional property. A valid value must be either a nonzero positive integer, '-1', or 0.
* By default, AnalyticalStorageTimeToLive is set to 0 meaning the analytical store is turned off for the container;
* By default, AnalyticalStoreTimeToLive is set to 0 meaning the analytical store is turned off for the container;
* -1 means documents in analytical store never expire.
* The unit of measurement is seconds. The maximum allowed value is 2147483647.
*
* @param timeToLive the analytical storage time to live in seconds.
* @param timeToLive the analytical store time to live in seconds.
* @return the CosmosContainerProperties.
*/
public CosmosContainerProperties setAnalyticalStorageTimeToLiveInSeconds(Integer timeToLive) {
public CosmosContainerProperties setAnalyticalStoreTimeToLiveInSeconds(Integer timeToLive) {
// a "null" value is represented as a missing element on the wire.
// setting timeToLive to null should remove the property from the property bag.
if (timeToLive != null) {
Expand All @@ -267,16 +267,16 @@ public CosmosContainerProperties setAnalyticalStorageTimeToLiveInSeconds(Integer
}

/**
* Gets the analytical storage time to live in seconds for items in a container from the Azure Cosmos DB service.
* Gets the analytical store time to live in seconds for items in a container from the Azure Cosmos DB service.
*
* It is an optional property. A valid value must be either a nonzero positive integer, '-1', or 0.
* By default, AnalyticalStorageTimeToLive is set to 0 meaning the analytical store is turned off for the container;
* By default, AnalyticalStoreTimeToLive is set to 0 meaning the analytical store is turned off for the container;
* -1 means documents in analytical store never expire.
* The unit of measurement is seconds. The maximum allowed value is 2147483647.
*
* @return analytical ttl
*/
public Integer getAnalyticalStorageTimeToLiveInSeconds() {
public Integer getAnalyticalStoreTimeToLiveInSeconds() {
if (super.has(Constants.Properties.ANALYTICAL_STORAGE_TTL)) {
return super.getInt(Constants.Properties.ANALYTICAL_STORAGE_TTL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import com.azure.cosmos.models.CosmosAsyncDatabaseResponse;
import com.azure.cosmos.models.CosmosContainerProperties;

import java.time.Instant;

public class AnalyticalStorageCodeSnippet {

public static void main(String[] args) throws Exception {
Expand All @@ -20,7 +18,7 @@ public static void main(String[] args) throws Exception {

CosmosAsyncDatabaseResponse database = client.createDatabaseIfNotExists("testDB").block();
CosmosContainerProperties cosmosContainerProperties = new CosmosContainerProperties("testContainer", "/id");
cosmosContainerProperties.setAnalyticalStorageTimeToLiveInSeconds(-1);
cosmosContainerProperties.setAnalyticalStoreTimeToLiveInSeconds(-1);

database.getDatabase().createContainer(cosmosContainerProperties).block();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void createContainer_withAnalyticalTTL(Integer analyticalTTL) throws Exce
String collectionName = UUID.randomUUID().toString();
CosmosContainerProperties containerProperties = new CosmosContainerProperties(collectionName, "/id");

containerProperties.setAnalyticalStorageTimeToLiveInSeconds(analyticalTTL);
containerProperties.setAnalyticalStoreTimeToLiveInSeconds(analyticalTTL);
if (analyticalTTL != null && analyticalTTL > 0) {
containerProperties.setDefaultTimeToLiveInSeconds(analyticalTTL - 1);
}
Expand All @@ -101,7 +101,7 @@ public void createContainer_withAnalyticalTTL(Integer analyticalTTL) throws Exce
assertThat(containerResponse.getRequestCharge()).isGreaterThan(0);
validateContainerResponse(containerProperties, containerResponse);

assertThat(containerResponse.getProperties().getAnalyticalStorageTimeToLiveInSeconds()).isEqualTo(analyticalTTL);
assertThat(containerResponse.getProperties().getAnalyticalStoreTimeToLiveInSeconds()).isEqualTo(analyticalTTL);
}

@Test(groups = {"emulator"}, timeOut = TIMEOUT)
Expand Down