Class DatabasePartitionSet

java.lang.Object
com.arpnetworking.clusteraggregator.partitioning.DatabasePartitionSet
All Implemented Interfaces:
PartitionSet

public class DatabasePartitionSet extends Object implements PartitionSet
A partition set that is backed by an eBean database.
Author:
Brandon Arp (brandon dot arp at inscopemetrics dot com)
  • Constructor Details

    • DatabasePartitionSet

      public DatabasePartitionSet(Database database, PartitionSet partitionSet)
      Public constructor.
      Parameters:
      database - The database to use to back the data
      partitionSet - The partition set model backing this instance
  • Method Details

    • getExistingPartition

      public Optional<Integer> getExistingPartition(String key)
      Description copied from interface: PartitionSet
      Will return an existing partition mapping, or Optional.absent if one does not exist.
      Specified by:
      getExistingPartition in interface PartitionSet
      Parameters:
      key - the key to be partitioned
      Returns:
      a partition number
    • getOrCreatePartition

      public Optional<Integer> getOrCreatePartition(String key)
      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 interface PartitionSet
      Parameters:
      key - the key to be partitioned
      Returns:
      optionally, a partition number