你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Shard Class
- java.
lang. Object - IShardProvider<ValueT>
- com.
microsoft. azure. elasticdb. shard. base. Shard
- com.
public class Shard implements IShardProvider
Representation of a single shard. Shards are basically locators for data sources i.e. ShardLocations that have been registered with a shard map. Shards are used in mapping as targets of mappings (see PointMapping and RangeMapping).
Constructor Summary
Constructor | Description |
---|---|
Shard(ShardMapManager shardMapManager, ShardMap shardMap, ShardCreationInfo creationInfo) |
Constructs a Shard given shard creation arguments. |
Shard(ShardMapManager shardMapManager, ShardMap shardMap, StoreShard storeShard) |
Internal constructor that uses storage representation. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Shard |
clone()
Clones the instance. |
boolean |
equals(Object obj)
Determines whether the specified object is equal to the current object. |
boolean |
equals(Shard other)
Performs equality comparison with given Shard. |
UUID |
getId()
Identity of the shard. Each shard should have a unique one. |
Shard |
getLocation()
Gets Location of the shard. |
Shard |
getShardInfo()
Shard for the ShardProvider object. |
Shard |
getShardMap() |
UUID |
getShardMapId()
Identify of the ShardMap this shard belongs to. |
Shard |
getShardMapManager() |
Shard |
getStatus()
Gets the status of the shard which can be either online or offline. Connections can only be opened using Shard.OpenConnection(string, ConnectionOptions) on the shard map when the shard is online. Setting the shard status to offline prevents connections when the shard is undergoing maintenance operations. |
Store |
getStoreShard() |
Shard |
getValue()
Value corresponding to the Shard. Represents traits of the Shard object provided by the ShardInfo property. |
UUID |
getVersion()
Shard version. |
int |
hashCode()
Calculates the hash code for this instance. |
Connection |
openConnection(String connectionString)
Opens a regular SqlConnection to the specified shard, with Validate. |
Connection |
openConnection(String connectionString, ConnectionOptions options)
Opens a regular SqlConnection to the specified shard. |
Callable<Connection> |
openConnectionAsync(String connectionString)
Asynchronously opens a regular SqlConnection to the specified shard, with Validate. |
Callable<Connection> |
openConnectionAsync(String connectionString, ConnectionOptions options)
Asynchronously a regular SqlConnection to the specified shard. |
void | setShardMap(ShardMap value) |
void | setShardMapManager(ShardMapManager value) |
void | setStoreShard(StoreShard value) |
String |
toString()
Converts the object to its string representation. |
void |
validate(StoreShardMap shardMap, Connection conn)
Performs validation that the local representation is as up-to-date as the representation on the backing data store. |
Callable |
validateAsync(StoreShardMap shardMap, Connection conn)
Asynchronously performs validation that the local representation is as up-to-date as the representation on the backing data store. |
Constructor Details
Shard
public Shard(ShardMapManager shardMapManager, ShardMap shardMap, ShardCreationInfo creationInfo)
Constructs a Shard given shard creation arguments.
Parameters:
Shard
public Shard(ShardMapManager shardMapManager, ShardMap shardMap, StoreShard storeShard)
Internal constructor that uses storage representation.
Parameters:
Method Details
clone
public Shard clone()
Clones the instance.
Returns:
equals
public boolean equals(Object obj)
Determines whether the specified object is equal to the current object.
Parameters:
Returns:
equals
public boolean equals(Shard other)
Performs equality comparison with given Shard.
Parameters:
Returns:
getId
public UUID getId()
Identity of the shard. Each shard should have a unique one.
getLocation
public ShardLocation getLocation()
Gets Location of the shard.
getShardInfo
public Shard getShardInfo()
Shard for the ShardProvider object.
getShardMap
public ShardMap getShardMap()
getShardMapId
public UUID getShardMapId()
Identify of the ShardMap this shard belongs to.
getShardMapManager
public ShardMapManager getShardMapManager()
getStatus
public ShardStatus getStatus()
Gets the status of the shard which can be either online or offline. Connections can only be opened using Shard.OpenConnection(string, ConnectionOptions) on the shard map when the shard is online. Setting the shard status to offline prevents connections when the shard is undergoing maintenance operations.
getStoreShard
public StoreShard getStoreShard()
getValue
public ShardLocation getValue()
Value corresponding to the Shard. Represents traits of the Shard object provided by the ShardInfo property.
getVersion
public UUID getVersion()
Shard version.
hashCode
public int hashCode()
Calculates the hash code for this instance.
Returns:
openConnection
public Connection openConnection(String connectionString)
Opens a regular SqlConnection to the specified shard, with Validate.
Parameters:
openConnection
public Connection openConnection(String connectionString, ConnectionOptions options)
Opens a regular SqlConnection to the specified shard.
Parameters:
openConnectionAsync
public Callable
Asynchronously opens a regular SqlConnection to the specified shard, with Validate.
Parameters:
Returns:
openConnectionAsync
public Callable
Asynchronously a regular SqlConnection to the specified shard.
Parameters:
Returns:
setShardMap
public void setShardMap(ShardMap value)
Parameters:
setShardMapManager
public void setShardMapManager(ShardMapManager value)
Parameters:
setStoreShard
public void setStoreShard(StoreShard value)
Parameters:
toString
public String toString()
Converts the object to its string representation.
Returns:
validate
public void validate(StoreShardMap shardMap, Connection conn)
Performs validation that the local representation is as up-to-date as the representation on the backing data store.
Parameters:
validateAsync
public Callable validateAsync(StoreShardMap shardMap, Connection conn)
Asynchronously performs validation that the local representation is as up-to-date as the representation on the backing data store.
Parameters:
Returns: