Class MergeRegionRequest
java.lang.Object
me.tayebyassine.homestead.sessions.MergeRegionRequest
Tracks pending merge requests between regions.
A merge request is created when a region owner initiates a merge with another region. The request expires after 60 seconds if not accepted.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic longGet the source region ID for a merge request targeting the given region.static longGet the target region ID for a merge request originating from the given region.static booleanisFromHaveRequest(Region from) Check whether the given region has a pending merge request as the source.static booleanCheck whether the given region has a pending merge request as the target.static voidnewMergeRequest(Region from, Region to) Create a new merge request from one region to another.
-
Field Details
-
REQUESTS
-
-
Method Details
-
newMergeRequest
Create a new merge request from one region to another.If either region already has a pending request (as source or target), the new request is silently ignored.
- Parameters:
from- the region to merge from (will be deleted on accept)to- the region to merge into
-
isFromHaveRequest
Check whether the given region has a pending merge request as the source.- Parameters:
from- the region to check- Returns:
trueif the region has an outgoing merge request
-
isToHaveRequest
Check whether the given region has a pending merge request as the target.- Parameters:
to- the region to check- Returns:
trueif the region is the target of a merge request
-
getFrom
Get the source region ID for a merge request targeting the given region.- Parameters:
to- the target region- Returns:
- the source region ID, or
-1if no request exists
-
getTo
Get the target region ID for a merge request originating from the given region.- Parameters:
from- the source region- Returns:
- the target region ID
-