com.continuent.tungsten.replicator.shard
Class ShardTable

java.lang.Object
  extended by com.continuent.tungsten.replicator.shard.ShardTable

public class ShardTable
extends java.lang.Object

Provides a definition for the shard table, which is a catalog of currently known shards.

Version:
1.0
Author:
Robert Hodges

Field Summary
static java.lang.String SHARD_CRIT_COL
           
static java.lang.String SHARD_ID_COL
           
static java.lang.String SHARD_MASTER_COL
           
static java.lang.String TABLE_NAME
           
 
Constructor Summary
ShardTable(java.lang.String schema, java.lang.String tableType)
           
 
Method Summary
 int deleleAll(Database database)
          Drop all shard definitions.
 int delete(Database database, java.lang.String id)
          Delete a single existing shard definition.
 void initializeShardTable(Database database)
          Set up the shard table.
 int insert(Database database, Shard shard)
          Insert a shard definition into the database.
 java.util.List<java.util.Map<java.lang.String,java.lang.String>> list(Database conn)
          Return a list of currently known shards.
 int update(Database database, Shard shard)
          Update an existing shard definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_NAME

public static final java.lang.String TABLE_NAME
See Also:
Constant Field Values

SHARD_ID_COL

public static final java.lang.String SHARD_ID_COL
See Also:
Constant Field Values

SHARD_CRIT_COL

public static final java.lang.String SHARD_CRIT_COL
See Also:
Constant Field Values

SHARD_MASTER_COL

public static final java.lang.String SHARD_MASTER_COL
See Also:
Constant Field Values
Constructor Detail

ShardTable

public ShardTable(java.lang.String schema,
                  java.lang.String tableType)
Method Detail

initializeShardTable

public void initializeShardTable(Database database)
                          throws java.sql.SQLException
Set up the shard table.

Throws:
java.sql.SQLException

insert

public int insert(Database database,
                  Shard shard)
           throws java.sql.SQLException
Insert a shard definition into the database. The shard may not already exist.

Throws:
java.sql.SQLException

update

public int update(Database database,
                  Shard shard)
           throws java.sql.SQLException
Update an existing shard definition. The shard must exist.

Throws:
java.sql.SQLException

deleleAll

public int deleleAll(Database database)
              throws java.sql.SQLException
Drop all shard definitions.

Throws:
java.sql.SQLException

delete

public int delete(Database database,
                  java.lang.String id)
           throws java.sql.SQLException
Delete a single existing shard definition.

Throws:
java.sql.SQLException

list

public java.util.List<java.util.Map<java.lang.String,java.lang.String>> list(Database conn)
                                                                      throws java.sql.SQLException
Return a list of currently known shards.

Throws:
java.sql.SQLException