Class ConsistencyPolicy


  • public final class ConsistencyPolicy
    extends Object
    The consistency policy for the Cosmos DB database account.
    • Constructor Detail

      • ConsistencyPolicy

        public ConsistencyPolicy()
    • Method Detail

      • defaultConsistencyLevel

        public DefaultConsistencyLevel defaultConsistencyLevel()
        Get the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos DB account.
        Returns:
        the defaultConsistencyLevel value.
      • withDefaultConsistencyLevel

        public ConsistencyPolicy withDefaultConsistencyLevel​(DefaultConsistencyLevel defaultConsistencyLevel)
        Set the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos DB account.
        Parameters:
        defaultConsistencyLevel - the defaultConsistencyLevel value to set.
        Returns:
        the ConsistencyPolicy object itself.
      • 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 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.
        Returns:
        the maxStalenessPrefix value.
      • 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 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.
        Parameters:
        maxStalenessPrefix - the maxStalenessPrefix value to set.
        Returns:
        the ConsistencyPolicy object itself.
      • 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:
        the maxIntervalInSeconds value.
      • 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:
        maxIntervalInSeconds - the maxIntervalInSeconds value to set.
        Returns:
        the ConsistencyPolicy object itself.
      • validate

        public void validate()
        Validates the instance.
        Throws:
        IllegalArgumentException - thrown if the instance is not valid.