ConsistencyPolicy Class
- java.
lang. Object - com.
azure. resourcemanager. cosmos. models. ConsistencyPolicy
- com.
Implements
public final class ConsistencyPolicy
implements JsonSerializable<ConsistencyPolicy>
The consistency policy for the Cosmos DB database account.
Constructor Summary
Constructor | Description |
---|---|
ConsistencyPolicy() |
Creates an instance of Consistency |
Method Summary
Modifier and Type | Method and Description |
---|---|
Default |
defaultConsistencyLevel()
Get the default |
static
Consistency |
fromJson(JsonReader jsonReader)
Reads an instance of Consistency |
Integer |
maxIntervalInSeconds()
Get the max |
Long |
maxStalenessPrefix()
Get the max |
Json |
toJson(JsonWriter jsonWriter) |
void |
validate()
Validates the instance. |
Consistency |
withDefaultConsistencyLevel(DefaultConsistencyLevel defaultConsistencyLevel)
Set the default |
Consistency |
withMaxIntervalInSeconds(Integer maxIntervalInSeconds)
Set the max |
Consistency |
withMaxStalenessPrefix(Long maxStalenessPrefix)
Set the max |
Methods inherited from java.lang.Object
Constructor Details
ConsistencyPolicy
public ConsistencyPolicy()
Creates an instance of ConsistencyPolicy class.
Method Details
defaultConsistencyLevel
public DefaultConsistencyLevel defaultConsistencyLevel()
Get the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos DB account.
Returns:
fromJson
public static ConsistencyPolicy fromJson(JsonReader jsonReader)
Reads an instance of ConsistencyPolicy from the JsonReader.
Parameters:
Returns:
Throws:
maxIntervalInSeconds
public Integer maxIntervalInSeconds()
Get the maxIntervalInSeconds property: When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.
Returns:
maxStalenessPrefix
public Long maxStalenessPrefix()
Get the maxStalenessPrefix property: When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 \u2013 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.
Returns:
toJson
validate
public void validate()
Validates the instance.
withDefaultConsistencyLevel
public ConsistencyPolicy withDefaultConsistencyLevel(DefaultConsistencyLevel defaultConsistencyLevel)
Set the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos DB account.
Parameters:
Returns:
withMaxIntervalInSeconds
public ConsistencyPolicy withMaxIntervalInSeconds(Integer maxIntervalInSeconds)
Set the maxIntervalInSeconds property: When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.
Parameters:
Returns:
withMaxStalenessPrefix
public ConsistencyPolicy withMaxStalenessPrefix(Long maxStalenessPrefix)
Set the maxStalenessPrefix property: When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 \u2013 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.
Parameters:
Returns:
Applies to
Azure SDK for Java