Class WriteOptions

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    BulkWriteOptions

    public class WriteOptions
    extends java.lang.Object
    implements java.lang.Cloneable
    WriteOptions is passed to store operations that can update the store to specify non-default behavior relating to durability, timeouts and expiry operations.

    The default behavior is configured when a store is opened using KVStoreConfig.

    Since:
    3.0
    • Constructor Summary

      Constructors 
      Constructor Description
      WriteOptions()
      Creates a WriteOptions with default values.
      WriteOptions​(Durability durability, long timeout, java.util.concurrent.TimeUnit timeoutUnit)
      Creates a WriteOptions with the specified parameters.
      WriteOptions​(WriteOptions options)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object clone()  
      Durability getDurability()
      Returns the durability associated with the operation.
      int getIdentityCacheSize()
      Gets the number of generated identity values that are requested from the server during a put.
      long getTimeout()
      Returns the timeout, which is an upper bound on the time interval for processing the operation.
      java.util.concurrent.TimeUnit getTimeoutUnit()
      Returns the unit of the timeout parameter.
      boolean getUpdateTTL()
      Returns true if the absolute expiration time is to be modified during update operations.
      WriteOptions setDurability​(Durability durability)
      Sets durability of write operation.
      WriteOptions setIdentityCacheSize​(int identityCacheSize)
      Sets the number of generated identity values that are requested from the server during a put.
      WriteOptions setTimeout​(long timeout, java.util.concurrent.TimeUnit timeoutUnit)
      Sets timeout for write operation.
      WriteOptions setUpdateTTL​(boolean flag)
      Sets whether absolute expiration time will be modified during update.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WriteOptions

        public WriteOptions​(Durability durability,
                            long timeout,
                            java.util.concurrent.TimeUnit timeoutUnit)
        Creates a WriteOptions with the specified parameters.

        If durability is null, the default durability is used.

        The timeout parameter is an upper bound on the time interval for processing the operation. A best effort is made not to exceed the specified limit. If zero, the default request timeout is used.

        If timeout is not 0, the timeoutUnit parameter must not be null.

        Parameters:
        durability - the write durability to use
        timeout - the timeout value to use
        timeoutUnit - the TimeUnit used by the timeout parameter
        Throws:
        java.lang.IllegalArgumentException - if timeout is negative
        java.lang.IllegalArgumentException - if timeout is > 0 and timeoutUnit is null
      • WriteOptions

        public WriteOptions​(WriteOptions options)
    • Method Detail

      • setDurability

        public WriteOptions setDurability​(Durability durability)
        Sets durability of write operation.
        Parameters:
        durability - can be null. If null, the default durability will be used.
        Returns:
        this
        Since:
        4.0
      • setTimeout

        public WriteOptions setTimeout​(long timeout,
                                       java.util.concurrent.TimeUnit timeoutUnit)
        Sets timeout for write operation.
        Parameters:
        timeout - the timeout value to use
        timeoutUnit - the TimeUnit used by the timeout parameter
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - if timeout is negative
        java.lang.IllegalArgumentException - if timeout is > 0 and timeoutUnit is null
        Since:
        4.0
      • getDurability

        public Durability getDurability()
        Returns the durability associated with the operation.
        Returns:
        the durability or null
      • getTimeout

        public long getTimeout()
        Returns the timeout, which is an upper bound on the time interval for processing the operation. A best effort is made not to exceed the specified limit. If zero, the default request timeout is used.
        Returns:
        the timeout or zero
      • getTimeoutUnit

        public java.util.concurrent.TimeUnit getTimeoutUnit()
        Returns the unit of the timeout parameter.
        Returns:
        the TimeUnit or null if the timeout has not been set.
        Since:
        4.0
      • setUpdateTTL

        public WriteOptions setUpdateTTL​(boolean flag)
        Sets whether absolute expiration time will be modified during update. If false and the operation updates a record, the record's expiration time will not change.
        If the operation inserts a record, this parameter is ignored and the specified TTL is always applied.
        By default, this property is false. To update expiration time of an existing record, this flag must be set to true.
        Parameters:
        flag - set to true if the operation should update an existing record's expiration time.
        Returns:
        this
        Since:
        4.0
      • getUpdateTTL

        public boolean getUpdateTTL()
        Returns true if the absolute expiration time is to be modified during update operations.
        Since:
        4.0
      • setIdentityCacheSize

        public WriteOptions setIdentityCacheSize​(int identityCacheSize)
        Sets the number of generated identity values that are requested from the server during a put. This takes precedence to the DDL identity CACHE option. Any value equal of less than 0 means that the DDL identity CACHE value is used.
        Since:
        18.3
      • getIdentityCacheSize

        public int getIdentityCacheSize()
        Gets the number of generated identity values that are requested from the server during a put.
        Since:
        18.3
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
        Since:
        4.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Since:
        4.0