ListShardMap<KeyT> Class

  • java.lang.Object
    • Cloneable
      • ShardMap
        • com.microsoft.azure.elasticdb.shard.map.ListShardMap<KeyT>

Type Parameters

KeyT

public class ListShardMap extends ShardMap

Represents a shard map of points where points are of the specified key.

Constructor Summary

Constructor Description
ListShardMap(ShardMapManager shardMapManager, StoreShardMap ssm)

Constructs a new instance.

Method Summary

Modifier and Type Method and Description
ShardMap clone()

Clones the specified shard map.

ShardMap cloneCore()

Clones the current shard map instance.

PointMapping createPointMapping(KeyT point, Shard shard)

Creates and adds a point mapping to ShardMap.

PointMapping createPointMapping(PointMappingCreationInfo creationInfo)

Creates and adds a point mapping to ShardMap.

void deleteMapping(PointMapping mapping)

Removes a point mapping.

<V> IShardMapper getMapper()

Gets the mapper. This method is used by OpenConnection/Lookup of V.

PointMapping getMappingForKey(KeyT key)

Looks up the key value and returns the corresponding mapping. Only the global shard map store is searched, not the local cache. This is equivalent to .

PointMapping getMappingForKey(KeyT key, LookupOptions lookupOptions)

Looks up the key value and returns the corresponding mapping.

MappingLockToken getMappingLockOwner(PointMapping mapping)

Gets the lock owner id of the specified mapping.

List<PointMapping> getMappings()

Gets all the point mappings for the shard map.

List<PointMapping> getMappings(LookupOptions lookupOptions)

Gets all the point mappings for the shard map.

List<PointMapping> getMappings(Range range)

Gets all the mappings that exist within given range.

List<PointMapping> getMappings(Range range, LookupOptions lookupOptions)

Gets all the mappings that exist within given range.

List<PointMapping> getMappings(Range range, Shard shard)

Gets all the mappings that exist within given range and given shard.

List<PointMapping> getMappings(Range range, Shard shard, LookupOptions lookupOptions)

Gets all the mappings that exist within given range and given shard.

List<PointMapping> getMappings(Shard shard)

Gets all the mappings that exist for the given shard.

List<PointMapping> getMappings(Shard shard, LookupOptions lookupOptions)

Gets all the mappings that exist for the given shard.

void lockMapping(PointMapping mapping, MappingLockToken mappingLockToken)

Locks the mapping for the specified owner The state of a locked mapping can only be modified by the lock owner.

PointMapping markMappingOffline(PointMapping mapping)

Marks the specified mapping offline.

PointMapping markMappingOnline(PointMapping mapping)

Marks the specified mapping online.

boolean tryGetMappingForKey(KeyT key, LookupOptions lookupOptions, ReferenceObjectHelper<PointMapping> pointMapping)

Tries to looks up the key value and place the corresponding mapping in pointMapping .

boolean tryGetMappingForKey(KeyT key, ReferenceObjectHelper<PointMapping> pointMapping)

Tries to looks up the key value and place the corresponding mapping in pointMapping . Only the global shard map store is searched, not local cache. This is equivalent to .

void unlockMapping(MappingLockToken mappingLockToken)

Unlocks all mappings in this map that belong to the given MappingLockToken.

void unlockMapping(PointMapping mapping, MappingLockToken mappingLockToken)

Unlocks the specified mapping

PointMapping updateMapping(PointMapping currentMapping, PointMappingUpdate update)

Updates a PointMapping<KeyT> with the updates provided in the update parameter.

PointMapping updateMapping(PointMapping currentMapping, PointMappingUpdate update, MappingLockToken mappingLockToken)

Updates a point mapping with the changes provided in the update parameter.

Inherited Members

Constructor Details

ListShardMap

public ListShardMap(ShardMapManager shardMapManager, StoreShardMap ssm)

Constructs a new instance.

Parameters:

shardMapManager - Reference to ShardMapManager.
ssm - Storage representation.

Method Details

clone

public ShardMap clone()

Clones the specified shard map.

Returns:

A cloned instance of the shard map.

cloneCore

protected ShardMap cloneCore()

Clones the current shard map instance.

Returns:

Cloned shard map instance.

createPointMapping

public PointMapping createPointMapping(KeyT point, Shard shard)

Creates and adds a point mapping to ShardMap.

Parameters:

point - Point for which to create the mapping.
shard - Shard associated with the point mapping.

Returns:

Newly created mapping.

createPointMapping

public PointMapping createPointMapping(PointMappingCreationInfo creationInfo)

Creates and adds a point mapping to ShardMap.

Parameters:

creationInfo - Information about mapping to be added.

Returns:

Newly created mapping.

deleteMapping

public void deleteMapping(PointMapping mapping)

Removes a point mapping.

Parameters:

mapping - Mapping being removed.

getMapper

public IShardMapper getMapper()

Gets the mapper. This method is used by OpenConnection/Lookup of V.

Returns:

ListShardMapper for given key type.

getMappingForKey

public PointMapping getMappingForKey(KeyT key)

Looks up the key value and returns the corresponding mapping. Only the global shard map store is searched, not the local cache. This is equivalent to .

Parameters:

key - Input key value.

Returns:

Mapping that contains the key value.

getMappingForKey

public PointMapping getMappingForKey(KeyT key, LookupOptions lookupOptions)

Looks up the key value and returns the corresponding mapping.

Parameters:

key - Input key value.
lookupOptions - Whether to search in the cache and/or store.

Returns:

Mapping that contains the key value.

getMappingLockOwner

public MappingLockToken getMappingLockOwner(PointMapping mapping)

Gets the lock owner id of the specified mapping.

Parameters:

mapping - Input range mapping.

Returns:

An instance of MappingLockToken

getMappings

public List getMappings()

Gets all the point mappings for the shard map.

Returns:

Read-only collection of all point mappings on the shard map.

getMappings

public List getMappings(LookupOptions lookupOptions)

Gets all the point mappings for the shard map.

Parameters:

lookupOptions - Whether to search in the cache and/or store.

Returns:

Read-only collection of all point mappings on the shard map.

getMappings

public List getMappings(Range range)

Gets all the mappings that exist within given range.

Parameters:

range - Point value, any mapping overlapping with the range will be returned.

Returns:

Read-only collection of mappings that satisfy the given range constraint.

getMappings

public List getMappings(Range range, LookupOptions lookupOptions)

Gets all the mappings that exist within given range.

Parameters:

range - Point value, any mapping overlapping with the range will be returned.
lookupOptions - Whether to search in the cache and/or store.

Returns:

Read-only collection of mappings that satisfy the given range constraint.

getMappings

public List getMappings(Range range, Shard shard)

Gets all the mappings that exist within given range and given shard.

Parameters:

range - Point value, any mapping overlapping with the range will be returned.
shard - Shard for which the mappings will be returned.

Returns:

Read-only collection of mappings that satisfy the given range and shard constraints.

getMappings

public List getMappings(Range range, Shard shard, LookupOptions lookupOptions)

Gets all the mappings that exist within given range and given shard.

Parameters:

range - Point value, any mapping overlapping with the range will be returned.
shard - Shard for which the mappings will be returned.
lookupOptions - Whether to search in the cache and/or store.

Returns:

Read-only collection of mappings that satisfy the given range and shard constraints.

getMappings

public List getMappings(Shard shard)

Gets all the mappings that exist for the given shard.

Parameters:

shard - Shard for which the mappings will be returned.

Returns:

Read-only collection of mappings that satisfy the given shard constraint.

getMappings

public List getMappings(Shard shard, LookupOptions lookupOptions)

Gets all the mappings that exist for the given shard.

Parameters:

shard - Shard for which the mappings will be returned.
lookupOptions - Whether to search in the cache and/or store.

Returns:

Read-only collection of mappings that satisfy the given shard constraint.

lockMapping

public void lockMapping(PointMapping 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:

mapping - Input range mapping.
mappingLockToken - An instance of MappingLockToken

markMappingOffline

public PointMapping markMappingOffline(PointMapping mapping)

Marks the specified mapping offline.

Parameters:

mapping - Input point mapping.

Returns:

An offline mapping.

markMappingOnline

public PointMapping markMappingOnline(PointMapping mapping)

Marks the specified mapping online.

Parameters:

mapping - Input point mapping.

Returns:

An online mapping.

tryGetMappingForKey

public boolean tryGetMappingForKey(KeyT key, LookupOptions lookupOptions, ReferenceObjectHelper pointMapping)

Tries to looks up the key value and place the corresponding mapping in pointMapping .

Parameters:

key - Input key value.
lookupOptions - Whether to search in the cache and/or store.
pointMapping - Mapping that contains the key value.

Returns:

true if mapping is found, false otherwise.

tryGetMappingForKey

public boolean tryGetMappingForKey(KeyT key, ReferenceObjectHelper pointMapping)

Tries to looks up the key value and place the corresponding mapping in pointMapping . Only the global shard map store is searched, not local cache. This is equivalent to .

Parameters:

key - Input key value.
pointMapping - Mapping that contains the key value.

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:

mappingLockToken - An instance of MappingLockToken

unlockMapping

public void unlockMapping(PointMapping mapping, MappingLockToken mappingLockToken)

Unlocks the specified mapping

Parameters:

mapping - Input range mapping.
mappingLockToken - An instance of MappingLockToken

updateMapping

public PointMapping updateMapping(PointMapping currentMapping, PointMappingUpdate update)

Updates a PointMapping<KeyT> with the updates provided in the update parameter.

Parameters:

currentMapping - Mapping being updated.
update - Updated properties of the mapping.

Returns:

New instance of mapping with updated information.

updateMapping

public PointMapping updateMapping(PointMapping currentMapping, PointMappingUpdate update, MappingLockToken mappingLockToken)

Updates a point mapping with the changes provided in the update parameter.

Parameters:

currentMapping - Mapping being updated.
update - Updated properties of the Shard.
mappingLockToken - An instance of MappingLockToken

Returns:

New instance of mapping with updated information.

Applies to