public interface DistributionManager
PartitionAssignmentStrategy
to analyze the current state of the partition
usage, and formulate a desired distribution plan. The DistributionManager
is responsible for gathering and providing to the strategy the state
necessary to make distribution decisions, as well as collecting and enacting
the formulated distribution recommendations.
The DistributionManager provides a consistent and stable view of
Service-related state for the duration of the call to PartitionAssignmentStrategy.analyzeDistribution()
.
Modifier and Type | Method and Description |
---|---|
PartitionSet |
getIgnoredAdvice()
Return a set of partitions from the previous suggestions that were
ignored or rejected.
|
Member |
getMember(int nMemberId)
Return the ownership-enabled service member with the specified
mini-id, or null if the member does not exist.
|
PartitionSet |
getOwnedPartitions(Member member,
int iStore)
Return the set of partitions for which the specified member owns the
specified storage index (replica).
|
Set<Member> |
getOwnershipLeavingMembers()
Return the set of ownership-enabled members in the partitioned
service that are in the process of leaving.
|
Set<Member> |
getOwnershipMembers()
Return the set of ownership-enabled members in the partitioned service.
|
Ownership |
getPartitionOwnership(int nPartition)
Return the Ownership information for the specified partition.
|
PartitionStatistics[] |
getPartitionStats()
Return an array of the most recently available partition statistics,
indexed by partition-id.
|
long |
getSamplingPeriod()
Return the sampling period at which partition statistics are collected.
|
PartitionedService |
getService()
Return the partitioned service for which this DistributionManager
coordinates the distribution.
|
void |
scheduleNextAnalysis(long cMillis)
Schedule the next distribution analysis in the specified time interval.
|
void |
suggest(PartitionSet parts,
Ownership ownership)
Suggest a distribution change for the specified set of partitions,
indicating either primary or backup transfer (or both).
|
PartitionedService getService()
Member getMember(int nMemberId)
nMemberId
- the mini-idSet<Member> getOwnershipMembers()
Set<Member> getOwnershipLeavingMembers()
PartitionSet getOwnedPartitions(Member member, int iStore)
member
- the member to determine the the ownership foriStore
- the storage index (zero for primary)IllegalArgumentException
- if the backup number is non-positive or
greater than the backup count for this partitioned serviceOwnership getPartitionOwnership(int nPartition)
nPartition
- the partition to return the ownership forIllegalArgumentException
- if the partition number is negative or
greater than the partition count for this partitioned servicevoid suggest(PartitionSet parts, Ownership ownership)
Note: this method does not in any way enforce or guarantee that the specified transfers are performed; it merely provides advice
parts
- the set of partitions to perform distribution onownership
- the desired ownershipPartitionSet getIgnoredAdvice()
void scheduleNextAnalysis(long cMillis)
This method may influence, but does not guarantee the time of the next distribution analysis. This method may be called on any thread but has an effect only if this member is currently the distribution coordinator.
cMillis
- the delay (in ms) before the next analysis (must be > 0)long getSamplingPeriod()
PartitionStatistics[] getPartitionStats()