RangeShardMap<KeyT> Class
- java.
lang. Object - Cloneable
- ShardMap
- com.
microsoft. azure. elasticdb. shard. map. RangeShardMap<KeyT>
- com.
Type Parameters
- KeyT
public class RangeShardMap extends ShardMap
Represents a shard map of ranges. .
Constructor Summary
Constructor | Description |
---|---|
RangeShardMap(ShardMapManager shardMapManager, StoreShardMap ssm) |
Constructs a new instance. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Range |
clone()
Clones the given range shard map. |
Shard |
cloneCore()
Clones the current shard map instance. |
Range |
createRangeMapping(Range range, Shard shard)
Creates and adds a range mapping to ShardMap. |
Range |
createRangeMapping(RangeMappingCreationInfo creationInfo)
Creates and adds a range mapping to ShardMap. |
void |
deleteMapping(RangeMapping mapping)
Removes a range mapping. |
void |
deleteMapping(RangeMapping mapping, MappingLockToken mappingLockToken)
Removes a range mapping. |
<V> IShard |
getMapper()
Gets the mapper. This method is used by OpenConnection/Lookup of V. |
Range |
getMappingForKey(KeyT key)
Looks up the key value and returns the corresponding mapping. |
Range |
getMappingForKey(KeyT key, LookupOptions lookupOptions)
Looks up the key value and returns the corresponding mapping. |
Mapping |
getMappingLockOwner(RangeMapping mapping)
Gets the lock owner id of the specified mapping. |
List<Range |
getMappings()
Gets all the range mappings for the shard map. |
List<Range |
getMappings(LookupOptions lookupOptions)
Gets all the range mappings for the shard map. |
List<Range |
getMappings(Range range)
Gets all the range mappings that exist within given range. |
List<Range |
getMappings(Range range, LookupOptions lookupOptions)
Gets all the range mappings that exist within given range. |
List<Range |
getMappings(Range range, Shard shard)
Gets all the range mappings that exist within given range and given shard. |
List<Range |
getMappings(Range range, Shard shard, LookupOptions lookupOptions)
Gets all the range mappings that exist within given range and given shard. |
List<Range |
getMappings(Shard shard)
Gets all the range mappings that exist for the given shard. |
List<Range |
getMappings(Shard shard, LookupOptions lookupOptions)
Gets all the range mappings that exist for the given shard. |
void |
lockMapping(RangeMapping mapping, MappingLockToken mappingLockToken)
Locks the mapping for the specified owner The state of a locked mapping can only be modified by the lock owner. |
Range |
markMappingOffline(RangeMapping mapping)
Marks the specified mapping offline. |
Range |
markMappingOffline(RangeMapping mapping, MappingLockToken mappingLockToken)
Marks the specified mapping offline. |
Range |
markMappingOnline(RangeMapping mapping)
Marks the specified mapping online. |
Range |
markMappingOnline(RangeMapping mapping, MappingLockToken mappingLockToken)
Marks the specified mapping online. |
Range |
mergeMappings(RangeMapping left, RangeMapping right)
Merges 2 contiguous mappings into a single mapping. Both left and right mappings should point to the same location and must be contiguous. |
Range |
mergeMappings(RangeMapping left, RangeMapping right, MappingLockToken leftMappingLockToken, MappingLockToken rightMappingLockToken)
Merges 2 contiguous mappings into a single mapping. Both left and right mappings should point to the same location and must be contiguous. |
List<Range |
splitMapping(RangeMapping existingMapping, KeyT splitAt)
Splits the specified mapping into two new mappings using the specified key as boundary. The new mappings point to the same shard as the existing mapping. |
List<Range |
splitMapping(RangeMapping existingMapping, KeyT splitAt, MappingLockToken mappingLockToken)
Splits the specified mapping into two new mappings using the specified key as boundary. The new mappings point to the same shard as the existing mapping. |
boolean |
tryGetMappingForKey(KeyT key, LookupOptions lookupOptions, ReferenceObjectHelper<RangeMapping> rangeMapping)
Tries to looks up the key value and place the corresponding mapping in rangeMapping . |
boolean |
tryGetMappingForKey(KeyT key, ReferenceObjectHelper<RangeMapping> rangeMapping)
Tries to looks up the key value and place the corresponding mapping in rangeMapping . |
void |
unlockMapping(MappingLockToken mappingLockToken)
Unlocks all mappings in this map that belong to the given MappingLockToken. |
void |
unlockMapping(RangeMapping mapping, MappingLockToken mappingLockToken)
Unlocks the specified mapping |
Range |
updateMapping(RangeMapping currentMapping, RangeMappingUpdate update)
Updates a RangeMapping<KeyT> with the updates provided in the update parameter. |
Range |
updateMapping(RangeMapping currentMapping, RangeMappingUpdate update, MappingLockToken mappingLockToken)
Updates a RangeMapping<KeyT> with the updates provided in the update parameter. |
Inherited Members
Constructor Details
RangeShardMap
public RangeShardMap(ShardMapManager shardMapManager, StoreShardMap ssm)
Constructs a new instance.
Parameters:
Method Details
clone
public RangeShardMap clone()
Clones the given range shard map.
Returns:
cloneCore
protected ShardMap cloneCore()
Clones the current shard map instance.
Returns:
createRangeMapping
public RangeMapping createRangeMapping(Range range, Shard shard)
Creates and adds a range mapping to ShardMap.
Parameters:
Returns:
createRangeMapping
public RangeMapping createRangeMapping(RangeMappingCreationInfo creationInfo)
Creates and adds a range mapping to ShardMap.
Parameters:
Returns:
deleteMapping
public void deleteMapping(RangeMapping mapping)
Removes a range mapping.
Parameters:
deleteMapping
public void deleteMapping(RangeMapping mapping, MappingLockToken mappingLockToken)
Removes a range mapping.
Parameters:
getMapper
public
Gets the mapper. This method is used by OpenConnection/Lookup of V.
Returns:
getMappingForKey
public RangeMapping getMappingForKey(KeyT key)
Looks up the key value and returns the corresponding mapping.
Parameters:
Returns:
getMappingForKey
public RangeMapping getMappingForKey(KeyT key, LookupOptions lookupOptions)
Looks up the key value and returns the corresponding mapping.
Parameters:
Returns:
getMappingLockOwner
public MappingLockToken getMappingLockOwner(RangeMapping mapping)
Gets the lock owner id of the specified mapping.
Parameters:
Returns:
getMappings
public List
Gets all the range mappings for the shard map.
Returns:
getMappings
public List
Gets all the range mappings for the shard map.
Parameters:
Returns:
getMappings
public List
Gets all the range mappings that exist within given range.
Parameters:
Returns:
getMappings
public List
Gets all the range mappings that exist within given range.
Parameters:
Returns:
getMappings
public List
Gets all the range mappings that exist within given range and given shard.
Parameters:
Returns:
getMappings
public List
Gets all the range mappings that exist within given range and given shard.
Parameters:
Returns:
getMappings
public List
Gets all the range mappings that exist for the given shard.
Parameters:
Returns:
getMappings
public List
Gets all the range mappings that exist for the given shard.
Parameters:
Returns:
lockMapping
public void lockMapping(RangeMapping mapping, MappingLockToken mappingLockToken)
Locks the mapping for the specified owner The state of a locked mapping can only be modified by the lock owner.
Parameters:
markMappingOffline
public RangeMapping markMappingOffline(RangeMapping mapping)
Marks the specified mapping offline.
Parameters:
Returns:
markMappingOffline
public RangeMapping markMappingOffline(RangeMapping mapping, MappingLockToken mappingLockToken)
Marks the specified mapping offline.
Parameters:
Returns:
markMappingOnline
public RangeMapping markMappingOnline(RangeMapping mapping)
Marks the specified mapping online.
Parameters:
Returns:
markMappingOnline
public RangeMapping markMappingOnline(RangeMapping mapping, MappingLockToken mappingLockToken)
Marks the specified mapping online.
Parameters:
Returns:
mergeMappings
public RangeMapping mergeMappings(RangeMapping left, RangeMapping right)
Merges 2 contiguous mappings into a single mapping. Both left and right mappings should point to the same location and must be contiguous.
Parameters:
Returns:
mergeMappings
public RangeMapping mergeMappings(RangeMapping left, RangeMapping right, MappingLockToken leftMappingLockToken, MappingLockToken rightMappingLockToken)
Merges 2 contiguous mappings into a single mapping. Both left and right mappings should point to the same location and must be contiguous.
Parameters:
Returns:
splitMapping
public List
Splits the specified mapping into two new mappings using the specified key as boundary. The new mappings point to the same shard as the existing mapping.
Parameters:
Returns:
splitMapping
public List
Splits the specified mapping into two new mappings using the specified key as boundary. The new mappings point to the same shard as the existing mapping.
Parameters:
Returns:
tryGetMappingForKey
public boolean tryGetMappingForKey(KeyT key, LookupOptions lookupOptions, ReferenceObjectHelper
Tries to looks up the key value and place the corresponding mapping in rangeMapping .
Parameters:
Returns:
true
if mapping is found, false
otherwise.
tryGetMappingForKey
public boolean tryGetMappingForKey(KeyT key, ReferenceObjectHelper
Tries to looks up the key value and place the corresponding mapping in rangeMapping .
Parameters:
Returns:
true
if mapping is found, false
otherwise.
unlockMapping
public void unlockMapping(MappingLockToken mappingLockToken)
Unlocks all mappings in this map that belong to the given MappingLockToken.
Parameters:
unlockMapping
public void unlockMapping(RangeMapping mapping, MappingLockToken mappingLockToken)
Unlocks the specified mapping
Parameters:
updateMapping
public RangeMapping updateMapping(RangeMapping currentMapping, RangeMappingUpdate update)
Updates a RangeMapping<KeyT> with the updates provided in the update parameter.
Parameters:
Returns:
updateMapping
public RangeMapping updateMapping(RangeMapping currentMapping, RangeMappingUpdate update, MappingLockToken mappingLockToken)
Updates a RangeMapping<KeyT> with the updates provided in the update parameter.
Parameters:
Returns: