Hazelcast C++ Client
|
The. More...
#include <ClientFlakeIdGeneratorConfig.h>
Public Member Functions | |
ClientFlakeIdGeneratorConfig (const std::string &name) | |
const std::string & | getName () const |
Returns the configuration name. More... | |
ClientFlakeIdGeneratorConfig & | setName (const std::string &name) |
Sets the name or name pattern for this config. More... | |
int32_t | getPrefetchCount () const |
ClientFlakeIdGeneratorConfig & | setPrefetchCount (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 |
ClientFlakeIdGeneratorConfig & | setPrefetchValidityMillis (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... | |
The.
contains the configuration for the client regarding Flake ID Generator.
const std::string & hazelcast::client::config::ClientFlakeIdGeneratorConfig::getName | ( | ) | const |
Returns the configuration name.
This can be actual object name or pattern.
int32_t hazelcast::client::config::ClientFlakeIdGeneratorConfig::getPrefetchCount | ( | ) | const |
int64_t hazelcast::client::config::ClientFlakeIdGeneratorConfig::getPrefetchValidityMillis | ( | ) | const |
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.
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.
prefetchCount | the desired prefetch count, in the range 1..MAXIMUM_PREFETCH_COUNT. |
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.
prefetchValidityMs | the desired ID validity or unlimited, if configured to 0. |
client::exception::IllegalArgumentException | if prefetchValidityMillis is negative. |
|
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.