Package io.hekate.partition
Class RendezvousHashMapper.Builder
- java.lang.Object
-
- io.hekate.partition.RendezvousHashMapper.Builder
-
- Enclosing class:
- RendezvousHashMapper
public static final class RendezvousHashMapper.Builder extends Object
Builder forRendezvousHashMapper
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RendezvousHashMapper
build()
Constructs a new mapper.String
toString()
RendezvousHashMapper.Builder
withBackupNodes(int backupNodes)
Sets the amount of backup nodes that should be assigned to each partition by the mapper.RendezvousHashMapper.Builder
withPartitions(int partitions)
Sets the total amount of partitions that should be managed by the mapper (value must be a power of two).
-
-
-
Method Detail
-
build
public RendezvousHashMapper build()
Constructs a new mapper.- Returns:
- New mapper.
-
withPartitions
public RendezvousHashMapper.Builder withPartitions(int partitions)
Sets the total amount of partitions that should be managed by the mapper (value must be a power of two).Value of this parameter must be above zero and must be a power of two. Default value is
RendezvousHashMapper.DEFAULT_PARTITIONS
.- Parameters:
partitions
- Total amount of partitions that should be managed by the mapper (value must be a power of two).- Returns:
- This instance.
-
withBackupNodes
public RendezvousHashMapper.Builder withBackupNodes(int backupNodes)
Sets the amount of backup nodes that should be assigned to each partition by the mapper.If value of this parameter is zero then mapper will not manage backup nodes and
Partition.backupNodes()
will return an empty set. If value of this parameter is negative then mapper will use all available cluster nodes as backup nodes.- Parameters:
backupNodes
- Amount of backup nodes that should be assigned to each partition by the mapper.- Returns:
- This instance.
- See Also:
Partition.backupNodes()
-
-