你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
IShardMapper<MappingT,ValueT> Interface
Type Parameters
- MappingT
- ValueT
public interface IShardMapper<MappingT extends IShardProvider,ValueT>
Container for a collection of keys to shards mappings.
Method Summary
Modifier and Type | Method and Description |
---|---|
MappingT |
add(MappingT mapping)
Adds a mapping. |
MappingT |
lookup(ValueT key, LookupOptions lookupOptions)
Looks up the key value and returns the corresponding mapping. |
Connection | openConnectionForKey(ValueT key, String connectionString) |
Connection |
openConnectionForKey(ValueT key, String connectionString, ConnectionOptions options)
Given a key value, obtains a SqlConnection to the shard in the mapping that contains the key value. |
Callable<Connection> | openConnectionForKeyAsync(ValueT key, String connectionString) |
Callable<Connection> |
openConnectionForKeyAsync(ValueT key, String connectionString, ConnectionOptions options)
Given a key value, asynchronously obtains a SqlConnection to the shard in the mapping that contains the key value. |
void |
remove(MappingT mapping, UUID lockOwnerId)
Removes a mapping. |
boolean |
tryLookup(ValueT key, LookupOptions lookupOptions, ReferenceObjectHelper<MappingT> mapping)
Tries to looks up the key value and returns the corresponding mapping. |
Method Details
add
public MappingT add(MappingT mapping)
Adds a mapping.
Parameters:
lookup
public MappingT lookup(ValueT key, LookupOptions lookupOptions)
Looks up the key value and returns the corresponding mapping.
Parameters:
Returns:
openConnectionForKey
public Connection openConnectionForKey(ValueT key, String connectionString)
Parameters:
openConnectionForKey
public Connection openConnectionForKey(ValueT key, String connectionString, ConnectionOptions options)
Given a key value, obtains a SqlConnection to the shard in the mapping that contains the key value.
Parameters:
Returns:
openConnectionForKeyAsync
public Callable
Parameters:
openConnectionForKeyAsync
public Callable
Given a key value, asynchronously obtains a SqlConnection to the shard in the mapping that contains the key value.
Parameters:
Returns:
remove
public void remove(MappingT mapping, UUID lockOwnerId)
Removes a mapping.
Parameters:
tryLookup
public boolean tryLookup(ValueT key, LookupOptions lookupOptions, ReferenceObjectHelper
Tries to looks up the key value and returns the corresponding mapping.
Parameters:
Returns:
true
if mapping is found, false
otherwise.