Class InMemoryPartitionSet
java.lang.Object
com.arpnetworking.clusteraggregator.partitioning.InMemoryPartitionSet
- All Implemented Interfaces:
PartitionSet
Simple in-memory partition manager. This class *is not* thread safe.
- Author:
- Brandon Arp (brandon dot arp at inscopemetrics dot com)
-
Constructor Summary
ConstructorsConstructorDescriptionInMemoryPartitionSet
(int entriesPerPartition, int maxPartitions) Public constructor. -
Method Summary
Modifier and TypeMethodDescriptionWill return an existing partition mapping, or Optional.absent if one does not exist.Will return the partition mapping, creating one if possible.
-
Constructor Details
-
InMemoryPartitionSet
public InMemoryPartitionSet(int entriesPerPartition, int maxPartitions) Public constructor.- Parameters:
entriesPerPartition
- the number of entries per partitionmaxPartitions
- the maximum number of partitions
-
-
Method Details
-
getExistingPartition
Description copied from interface:PartitionSet
Will return an existing partition mapping, or Optional.absent if one does not exist.- Specified by:
getExistingPartition
in interfacePartitionSet
- Parameters:
key
- the key to be partitioned- Returns:
- a partition number
-
getOrCreatePartition
Description copied from interface:PartitionSet
Will return the partition mapping, creating one if possible. Will return Optional.absent() if a partition is unable to be created for the key.- Specified by:
getOrCreatePartition
in interfacePartitionSet
- Parameters:
key
- the key to be partitioned- Returns:
- optionally, a partition number
-