com.hazelcast.config

## Class RingbufferConfig

- java.lang.Object
- - com.hazelcast.config.RingbufferConfig

- All Implemented Interfaces:
    NamedConfig, DataSerializable, IdentifiedDataSerializable, com.hazelcast.nio.serialization.impl.Versioned, SplitBrainMergeTypeProvider

      public class RingbufferConfig
      extends Object
      implements SplitBrainMergeTypeProvider, IdentifiedDataSerializable, com.hazelcast.nio.serialization.impl.Versioned, NamedConfig

  Contains the configuration for the `Ringbuffer`.

  The RingBuffer is a replicated but not partitioned data-structure, so its content will be fully stored on a single member in the cluster and its backup in another member in the cluster.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_ASYNC_BACKUP_COUNT` Default value of asynchronous backup count
    `static int` | `DEFAULT_CAPACITY` Default value of capacity of the RingBuffer.
    `static InMemoryFormat` | `DEFAULT_IN_MEMORY_FORMAT` Default value for the in-memory format.
    `static int` | `DEFAULT_SYNC_BACKUP_COUNT` Default value of synchronous backup count
    `static int` | `DEFAULT_TTL_SECONDS` Default value for the time to live property.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RingbufferConfig()`
    `RingbufferConfig(RingbufferConfig config)` Clones a RingbufferConfig
    `RingbufferConfig(String name)` Creates a RingbufferConfig with the provided name.
    `RingbufferConfig(String name, RingbufferConfig config)` Creates a new RingbufferConfig by cloning an existing config and overriding the name.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `RingbufferConfig` | `getAsReadOnly()` Deprecated. this method will be removed in 4.0; it is meant for internal usage only
    `int` | `getAsyncBackupCount()` Gets the number of asynchronous backups.
    `int` | `getBackupCount()` Gets the number of synchronous backups.
    `int` | `getCapacity()` Gets the capacity of the ringbuffer.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `InMemoryFormat` | `getInMemoryFormat()` Returns the in-memory format.
    `MergePolicyConfig` | `getMergePolicyConfig()` Gets the `MergePolicyConfig` for this ringbuffer.
    `String` | `getName()` Returns the name of the ringbuffer.
    `Class` | `getProvidedMergeTypes()`
    `String` | `getQuorumName()` Returns the quorum name for operations.
    `RingbufferStoreConfig` | `getRingbufferStoreConfig()` Get the RingbufferStore (load and store ringbuffer items from/to a database) configuration.
    `int` | `getTimeToLiveSeconds()` Gets the time to live in seconds.
    `int` | `getTotalBackupCount()` Returns the total number of backups: backupCount plus asyncBackupCount.
    `int` | `hashCode()`
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `RingbufferConfig` | `setAsyncBackupCount(int asyncBackupCount)` Sets the number of asynchronous backups.
    `RingbufferConfig` | `setBackupCount(int backupCount)` Sets the number of synchronous backups.
    `RingbufferConfig` | `setCapacity(int capacity)` Sets the capacity of the ringbuffer.
    `RingbufferConfig` | `setInMemoryFormat(InMemoryFormat inMemoryFormat)` Sets the in-memory format.
    `RingbufferConfig` | `setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)` Sets the `MergePolicyConfig` for this ringbuffer.
    `RingbufferConfig` | `setName(String name)` Sets the name of the ringbuffer.
    `RingbufferConfig` | `setQuorumName(String quorumName)` Sets the quorum name for operations.
    `RingbufferConfig` | `setRingbufferStoreConfig(RingbufferStoreConfig ringbufferStoreConfig)` Set the RingbufferStore (load and store ringbuffer items from/to a database) configuration.
    `RingbufferConfig` | `setTimeToLiveSeconds(int timeToLiveSeconds)` Sets the time to live in seconds which is the maximum number of seconds for each item to stay in the ringbuffer before being removed.
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_CAPACITY

          public static final int DEFAULT_CAPACITY

      Default value of capacity of the RingBuffer.
      See Also:
        Constant Field Values

    - #### DEFAULT_SYNC_BACKUP_COUNT

          public static final int DEFAULT_SYNC_BACKUP_COUNT

      Default value of synchronous backup count
      See Also:
        Constant Field Values

    - #### DEFAULT_ASYNC_BACKUP_COUNT

          public static final int DEFAULT_ASYNC_BACKUP_COUNT

      Default value of asynchronous backup count
      See Also:
        Constant Field Values

    - #### DEFAULT_TTL_SECONDS

          public static final int DEFAULT_TTL_SECONDS

      Default value for the time to live property.
      See Also:
        Constant Field Values

    - #### DEFAULT_IN_MEMORY_FORMAT

          public static final InMemoryFormat DEFAULT_IN_MEMORY_FORMAT

      Default value for the in-memory format.

  - ### Constructor Detail

    - #### RingbufferConfig

          public RingbufferConfig()

    - #### RingbufferConfig

          public RingbufferConfig(String name)

      Creates a RingbufferConfig with the provided name.
      Parameters:
        `name` - the name
      Throws:
        `NullPointerException` - if name is `null`

    - #### RingbufferConfig

          public RingbufferConfig(RingbufferConfig config)

      Clones a RingbufferConfig
      Parameters:
        `config` - the ringbuffer config to clone
      Throws:
        `NullPointerException` - if config is `null`

    - #### RingbufferConfig

          public RingbufferConfig(String name,
                                  RingbufferConfig config)

      Creates a new RingbufferConfig by cloning an existing config and overriding the name.
      Parameters:
        `name` - the new name
        `config` - the config
      Throws:
        `NullPointerException` - if name or config is `null`

  - ### Method Detail

    - #### setName

          public RingbufferConfig setName(String name)

      Sets the name of the ringbuffer.
      Specified by:
        `setName` in interface `NamedConfig`
      Parameters:
        `name` - the name of the ringbuffer
      Returns:
        the updated `RingbufferConfig`
      Throws:
        `IllegalArgumentException` - if name is `null` or an empty string

    - #### getName

          public String getName()

      Returns the name of the ringbuffer.
      Specified by:
        `getName` in interface `NamedConfig`
      Returns:
        the name of the ringbuffer

    - #### getCapacity

          public int getCapacity()

      Gets the capacity of the ringbuffer.

      The capacity is the total number of items in the ringbuffer. The items will remain in the ringbuffer, but the oldest items will eventually be overwritten by the newest items.

      Returns:
        the capacity

    - #### setCapacity

          public RingbufferConfig setCapacity(int capacity)

      Sets the capacity of the ringbuffer.
      Parameters:
        `capacity` - the capacity
      Returns:
        the updated Config
      Throws:
        `IllegalArgumentException` - if capacity smaller than 1
      See Also:
        `getCapacity()`

    - #### getBackupCount

          public int getBackupCount()

      Gets the number of synchronous backups.
      Returns:
        number of synchronous backups

    - #### setBackupCount

          public RingbufferConfig setBackupCount(int backupCount)

      Sets the number of synchronous backups.
      Parameters:
        `backupCount` - the number of synchronous backups to set
      Returns:
        the updated SemaphoreConfig
      Throws:
        `IllegalArgumentException` - if backupCount smaller than 0, or larger than the maximum number of backup or the sum of the backups and async backups is larger than the maximum number of backups
      See Also:
        `setAsyncBackupCount(int)`, `getBackupCount()`

    - #### getAsyncBackupCount

          public int getAsyncBackupCount()

      Gets the number of asynchronous backups.
      Returns:
        the number of asynchronous backups

    - #### setAsyncBackupCount

          public RingbufferConfig setAsyncBackupCount(int asyncBackupCount)

      Sets the number of asynchronous backups. 0 means no backups.
      Parameters:
        `asyncBackupCount` - the number of asynchronous synchronous backups to set
      Returns:
        the updated SemaphoreConfig
      Throws:
        `IllegalArgumentException` - if asyncBackupCount smaller than 0, or larger than the maximum number of backup or the sum of the backups and async backups is larger than the maximum number of backups
      See Also:
        `setBackupCount(int)`, `getAsyncBackupCount()`

    - #### getTotalBackupCount

          public int getTotalBackupCount()

      Returns the total number of backups: backupCount plus asyncBackupCount.
      Returns:
        the total number of backups: backupCount plus asyncBackupCount

    - #### getTimeToLiveSeconds

          public int getTimeToLiveSeconds()

      Gets the time to live in seconds.
      Returns:
        the time to live in seconds or 0 if the items don't expire

    - #### setTimeToLiveSeconds

          public RingbufferConfig setTimeToLiveSeconds(int timeToLiveSeconds)

      Sets the time to live in seconds which is the maximum number of seconds for each item to stay in the ringbuffer before being removed.

      Entries that are older than `timeToLiveSeconds` are removed from the ringbuffer on the next ringbuffer operation (read or write).

      Time to live can be disabled by setting `timeToLiveSeconds` to 0. It means that items won't get removed because they expire. They may only be overwritten. When `timeToLiveSeconds` is disabled and after the tail does a full loop in the ring, the ringbuffer size will always be equal to the capacity.

      The `timeToLiveSeconds` can be any integer between 0 and `Integer.MAX_VALUE`. 0 means infinite. The default is 0.

      Parameters:
        `timeToLiveSeconds` - the time to live period in seconds
      Returns:
        the updated RingbufferConfig
      Throws:
        `IllegalArgumentException` - if timeToLiveSeconds smaller than 0

    - #### getInMemoryFormat

          public InMemoryFormat getInMemoryFormat()

      Returns the in-memory format.

      The in-memory format controls the format of the stored item in the ringbuffer:

      1. `InMemoryFormat.OBJECT`: the item is stored in deserialized format (a regular object)
      2. `InMemoryFormat.BINARY`: the item is stored in serialized format (a binary blob)

      The default is binary. The object InMemoryFormat is useful when:

      1. the object stored in object format has a smaller footprint than in binary format
      2. if there are readers using a filter. Since for every filter invocation, the object needs to be available in object format.

    - #### setInMemoryFormat

          public RingbufferConfig setInMemoryFormat(InMemoryFormat inMemoryFormat)

      Sets the in-memory format.

      The in-memory format controls the format of the stored item in the ringbuffer:

      1. `InMemoryFormat.OBJECT`: the item is stored in deserialized format (a regular object)
      2. `InMemoryFormat.BINARY`: the item is stored in serialized format (a binary blob)

      The default is binary. The object InMemoryFormat is useful when:

      1. the object stored in object format has a smaller footprint than in binary format
      2. if there are readers using a filter. Since for every filter invocation, the object needs to be available in object format.
      Parameters:
        `inMemoryFormat` - the new in memory format
      Returns:
        the updated Config
      Throws:
        `NullPointerException` - if inMemoryFormat is `null`
        `IllegalArgumentException` - if `InMemoryFormat.NATIVE` in-memory format is selected

    - #### getRingbufferStoreConfig

          public RingbufferStoreConfig getRingbufferStoreConfig()

      Get the RingbufferStore (load and store ringbuffer items from/to a database) configuration.
      Returns:
        the ringbuffer store configuration

    - #### setRingbufferStoreConfig

          public RingbufferConfig setRingbufferStoreConfig(RingbufferStoreConfig ringbufferStoreConfig)

      Set the RingbufferStore (load and store ringbuffer items from/to a database) configuration.
      Parameters:
        `ringbufferStoreConfig` - set the RingbufferStore configuration to this configuration
      Returns:
        the ringbuffer configuration

    - #### getQuorumName

          public String getQuorumName()

      Returns the quorum name for operations.
      Returns:
        the quorum name

    - #### setQuorumName

          public RingbufferConfig setQuorumName(String quorumName)

      Sets the quorum name for operations.
      Parameters:
        `quorumName` - the quorum name
      Returns:
        the updated configuration

    - #### getMergePolicyConfig

          public MergePolicyConfig getMergePolicyConfig()

      Gets the `MergePolicyConfig` for this ringbuffer.
      Returns:
        the `MergePolicyConfig` for this ringbuffer

    - #### setMergePolicyConfig

          public RingbufferConfig setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)

      Sets the `MergePolicyConfig` for this ringbuffer.
      Returns:
        the ringbuffer configuration

    - #### getProvidedMergeTypes

          public Class getProvidedMergeTypes()

      Specified by:
        `getProvidedMergeTypes` in interface `SplitBrainMergeTypeProvider`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### equals

          public final boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getAsReadOnly

          public RingbufferConfig getAsReadOnly()

      Deprecated. this method will be removed in 4.0; it is meant for internal usage only
      Gets immutable version of this configuration.
      Returns:
        immutable version of this configuration

Copyright © 2019. All rights reserved.