Partager via


ConsistencyPolicy Class

public final class ConsistencyPolicy
extends JsonSerializable

Encapsulates the settings for consistency policy in the Azure Cosmos DB database service.

Constructor Summary

Constructor Description
ConsistencyPolicy(String jsonString)

Constructor.

ConsistencyPolicy(JSONObject jsonObject)

Constructor.

Method Summary

Modifier and Type Method and Description
ConsistencyLevel getDefaultConsistencyLevel()

Get the name of the resource.

int getMaxStalenessIntervalInSeconds()

Gets the in bounded staleness consistency, the maximum allowed staleness in terms time interval.

int getMaxStalenessPrefix()

Gets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers (aka version).

void setDefaultConsistencyLevel(ConsistencyLevel level)

Set the name of the resource.

void setMaxStalenessIntervalInSeconds(int maxStalenessIntervalInSeconds)

Sets the in bounded staleness consistency, the maximum allowed staleness in terms time interval.

void setMaxStalenessPrefix(int maxStalenessPrefix)

Sets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers (aka version).

Methods inherited from JsonSerializable

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

ConsistencyPolicy

public ConsistencyPolicy(String jsonString)

Constructor.

Parameters:

jsonString - the json string that represents the consistency policy.

ConsistencyPolicy

public ConsistencyPolicy(JSONObject jsonObject)

Constructor.

Parameters:

jsonObject - the json object that represents the consistency policy.

Method Details

getDefaultConsistencyLevel

public ConsistencyLevel getDefaultConsistencyLevel()

Get the name of the resource.

Returns:

the default consistency level.

getMaxStalenessIntervalInSeconds

public int getMaxStalenessIntervalInSeconds()

Gets the in bounded staleness consistency, the maximum allowed staleness in terms time interval.

Returns:

the max staleness prefix.

getMaxStalenessPrefix

public int getMaxStalenessPrefix()

Gets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers (aka version).

Returns:

the max staleness prefix.

setDefaultConsistencyLevel

public void setDefaultConsistencyLevel(ConsistencyLevel level)

Set the name of the resource.

Parameters:

level - the consistency level.

setMaxStalenessIntervalInSeconds

public void setMaxStalenessIntervalInSeconds(int maxStalenessIntervalInSeconds)

Sets the in bounded staleness consistency, the maximum allowed staleness in terms time interval.

Parameters:

maxStalenessIntervalInSeconds - the max staleness interval in seconds.

setMaxStalenessPrefix

public void setMaxStalenessPrefix(int maxStalenessPrefix)

Sets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers (aka version).

Parameters:

maxStalenessPrefix - the max staleness prefix.

Applies to