다음을 통해 공유


SchemaInfoCollection Class

  • java.lang.Object
    • java.util.ArrayList<Map.Entry<String, SchemaInfo>>
      • com.microsoft.azure.elasticdb.shard.schema.SchemaInfoCollection

public class SchemaInfoCollection

Provides storage services to a client for storing or updating or retrieving schema information associated with a sharding scheme and assigning names to individual buckets of information. The class doesn't store the association between a sharding scheme and the metadata unit. It's the caller's responsibility to maintain the mapping.

Constructor Summary

Constructor Description
SchemaInfoCollection(ShardMapManager shardMapManager)

Constructs an instance of schema info collection.

Method Summary

Modifier and Type Method and Description
final void add(String shardMapName, SchemaInfo schemaInfo)

Adds a SchemaInfo that is associated with the given ShardMap name. The associated data contains information concerning sharded tables and reference tables. If you try to add a SchemaInfo with an existing name, a name-conflict exception will be thrown

final SchemaInfo get(String shardMapName)

Fetches the SchemaInfo stored with the supplied ShardMap name.

final Iterator<Map.Entry<String, SchemaInfo>> iterator()

Returns an enumerator that iterates through the SchemaInfoCollection.

final void remove(String shardMapName)

Removes the SchemaInfo with the given ShardMap name.

final void replace(String shardMapName, SchemaInfo schemaInfo)

Replaces the SchemaInfo with the given ShardMap name.

final boolean tryGet(String shardMapName, ReferenceObjectHelper<SchemaInfo> schemaInfo)

Tries to fetch the SchemaInfo with the given ShardMap name without raising any exception if data doesn't exist.

Constructor Details

SchemaInfoCollection

public SchemaInfoCollection(ShardMapManager shardMapManager)

Constructs an instance of schema info collection.

Parameters:

shardMapManager - Shard map manager object.

Method Details

add

public final void add(String shardMapName, SchemaInfo schemaInfo)

Adds a SchemaInfo that is associated with the given ShardMap name. The associated data contains information concerning sharded tables and reference tables. If you try to add a SchemaInfo with an existing name, a name-conflict exception will be thrown

Parameters:

shardMapName - The name of the ShardMap that the SchemaInfo will be associated with
schemaInfo - Sharding schema information.

get

public final SchemaInfo get(String shardMapName)

Fetches the SchemaInfo stored with the supplied ShardMap name.

Parameters:

shardMapName - The name of the ShardMap to get.

Returns:

SchemaInfo object.

iterator

public final Iterator> iterator()

Returns an enumerator that iterates through the SchemaInfoCollection.

Returns:

Enumerator of key-value pairs of name and SchemaInfo objects.

remove

public final void remove(String shardMapName)

Removes the SchemaInfo with the given ShardMap name.

Parameters:

shardMapName - The name of the ShardMap whose SchemaInfo will be removed

replace

public final void replace(String shardMapName, SchemaInfo schemaInfo)

Replaces the SchemaInfo with the given ShardMap name.

Parameters:

shardMapName - The name of the ShardMap whose SchemaInfo will be replaced.
schemaInfo - Sharding schema information.

tryGet

public final boolean tryGet(String shardMapName, ReferenceObjectHelper schemaInfo)

Tries to fetch the SchemaInfo with the given ShardMap name without raising any exception if data doesn't exist.

Parameters:

shardMapName - The name of the ShardMap whose SchemaInfo will be fetched
schemaInfo - The SchemaInfo that was fetched or null if retrieval failed

Returns:

true if schema info exists with given name, false otherwise.

Applies to