com.github.drinkjava2.jsqlbox.sharding
Interface ShardingTool

All Known Implementing Classes:
ShardingModTool, ShardingRangeTool

public interface ShardingTool

This interface defines some Sharding methods

Since:
1.7.0.3
Author:
Yong Zhu

Method Summary
 SqlBoxContext[] handleShardDatabase(SqlBoxContext ctx, TableModel tableModel, Object... shardKey)
          Dealing a ShardTable SqlItem, return real master SqlBoxContexts array
 String[] handleShardTable(SqlBoxContext ctx, TableModel tableModel, Object... shardKey)
          Dealing a SqlItem(SqlOption.SHARD_TABLE, entityOrClass, shardKey1, optionalShardKey2) item, return real table names array
 

Method Detail

handleShardTable

String[] handleShardTable(SqlBoxContext ctx,
                          TableModel tableModel,
                          Object... shardKey)
Dealing a SqlItem(SqlOption.SHARD_TABLE, entityOrClass, shardKey1, optionalShardKey2) item, return real table names array

Parameters:
ctx - Current SqlBoxContext instance
entityOrClass - The entity or class need do sharding
shardKey - The shard key or keys
Returns:
A String[] stored table names or null if the sharding strategy is not fit for current implementation

handleShardDatabase

SqlBoxContext[] handleShardDatabase(SqlBoxContext ctx,
                                    TableModel tableModel,
                                    Object... shardKey)
Dealing a ShardTable SqlItem, return real master SqlBoxContexts array

Parameters:
ctx - Current SqlBoxContext instance
entityOrClass - The entity or class need do sharding
shardKey - The shard key or keys
Returns:
A SqlBoxContext[] stored master SqlBoxContexts or null if the sharding strategy is not fit for current implementation


Copyright © 2018. All rights reserved.