Hazelcast C++ Client
Public Member Functions | Static Public Attributes | List of all members
hazelcast::client::config::ClientFlakeIdGeneratorConfig Class Reference

The. More...

#include <ClientFlakeIdGeneratorConfig.h>

Public Member Functions

 ClientFlakeIdGeneratorConfig (const std::string &name)
 
const std::string & getName () const
 Returns the configuration name. More...
 
ClientFlakeIdGeneratorConfigsetName (const std::string &name)
 Sets the name or name pattern for this config. More...
 
int32_t getPrefetchCount () const
 
ClientFlakeIdGeneratorConfigsetPrefetchCount (int32_t prefetchCount)
 Sets how many IDs are pre-fetched on the background when one call to FlakeIdGenerator#newId() is made. More...
 
int64_t getPrefetchValidityMillis () const
 
ClientFlakeIdGeneratorConfigsetPrefetchValidityMillis (int64_t prefetchValidityMillis)
 Sets for how long the pre-fetched IDs can be used. More...
 

Static Public Attributes

static const int32_t DEFAULT_PREFETCH_COUNT = 100
 Default value for getPrefetchCount().
 
static const int64_t DEFAULT_PREFETCH_VALIDITY_MILLIS = 600000
 Default value for getPrefetchValidityMillis().
 
static const int32_t MAXIMUM_PREFETCH_COUNT = 100000
 Maximum value for prefetch count. More...
 

Detailed Description

The.

ClientFlakeIdGeneratorConfig

contains the configuration for the client regarding Flake ID Generator.

Member Function Documentation

◆ getName()

const std::string & hazelcast::client::config::ClientFlakeIdGeneratorConfig::getName ( ) const

Returns the configuration name.

This can be actual object name or pattern.

◆ getPrefetchCount()

int32_t hazelcast::client::config::ClientFlakeIdGeneratorConfig::getPrefetchCount ( ) const
See also
#setPrefetchCount(int)

◆ getPrefetchValidityMillis()

int64_t hazelcast::client::config::ClientFlakeIdGeneratorConfig::getPrefetchValidityMillis ( ) const
See also
#setPrefetchValidityMillis(long)

◆ setName()

ClientFlakeIdGeneratorConfig & hazelcast::client::config::ClientFlakeIdGeneratorConfig::setName ( const std::string &  name)

Sets the name or name pattern for this config.

Must not be modified after this instance is added to ClientConfig.

Returns
this instance for fluent API

◆ setPrefetchCount()

ClientFlakeIdGeneratorConfig & hazelcast::client::config::ClientFlakeIdGeneratorConfig::setPrefetchCount ( int32_t  prefetchCount)

Sets how many IDs are pre-fetched on the background when one call to FlakeIdGenerator#newId() is made.

Default is 100.

Parameters
prefetchCountthe desired prefetch count, in the range 1..MAXIMUM_PREFETCH_COUNT.
Returns
this instance for fluent API

◆ setPrefetchValidityMillis()

ClientFlakeIdGeneratorConfig & hazelcast::client::config::ClientFlakeIdGeneratorConfig::setPrefetchValidityMillis ( int64_t  prefetchValidityMillis)

Sets for how long the pre-fetched IDs can be used.

If this time elapses, a new batch of IDs will be fetched. Time unit is milliseconds, default is 600,000 (10 minutes).

The IDs contain timestamp component, which ensures rough global ordering of IDs. If an ID is assigned to an object that was created much later, it will be much out of order. If you don't care about ordering, set this value to 0.

This setting pertains only to newId calls made on the member that configured it.

Parameters
prefetchValidityMsthe desired ID validity or unlimited, if configured to 0.
Returns
this instance for fluent API
Exceptions
client::exception::IllegalArgumentExceptionif prefetchValidityMillis is negative.

Member Data Documentation

◆ MAXIMUM_PREFETCH_COUNT

const int32_t hazelcast::client::config::ClientFlakeIdGeneratorConfig::MAXIMUM_PREFETCH_COUNT = 100000
static

Maximum value for prefetch count.

The limit is ~10% of the time we allow the IDs to be from the future (see com.hazelcast.flakeidgen.impl.FlakeIdGeneratorProxy#ALLOWED_FUTURE_MILLIS).

The reason to limit the prefetch count is that a single call to FlakeIdGenerator#newId() might be blocked if the future allowance is exceeded: we want to avoid a single call for large batch to block another call for small batch.


The documentation for this class was generated from the following files: