org.tinygroup.dbrouter
public interface RouterManager
| Modifier and Type | Method and 描述 |
|---|---|
void |
addRouter(Router router)
添加集群
|
void |
addRouters(InputStream inputStream)
根据
|
void |
addRouters(Routers routers)
添加一组集群
|
void |
addRouters(String routerFilePath)
根据资源路径加载配置
|
void |
addStatementProcessor(StatementProcessor statementProcessor)
添加语句处理器
|
Cache |
getCache()
获取缓存
|
Partition |
getPartition(Router router,
String sql)
获取匹配的首个分区
|
Partition |
getPartition(String routerId,
String sql)
获取匹配的首个分区
|
List<Partition> |
getPartitions(Router router,
String sql)
获取匹配的分区
|
Collection<Partition> |
getPartitions(String routerId,
String sql)
获取匹配的分区
|
<T> T |
getPrimaryKey(Router router,
String tableName)
给某个集群的数据表产生主键
|
Router |
getRouter(String routerId)
获取集群
|
Map<String,Router> |
getRouterMap()
获取集群配置Map
|
ShardBalance |
getShardBalance()
返回分片均衡器
|
List<Shard> |
getShards(Partition partition,
String sql,
Object... preparedParams)
获取匹配的分片
|
String |
getSql(Partition partition,
Shard shard,
String sql,
Object... preparedParams)
返回分片执行语句
|
Statement |
getSqlStatement(String sql)
返回SQL对应的Statement
|
List<StatementProcessor> |
getStatementProcessorList()
返回所有语句处理器列表
|
boolean |
isMatch(Partition partition,
Shard shard,
String sql,
Object... preparedParams)
返回某个分片是否匹配
|
boolean |
isMatch(Partition partition,
String sql)
返回某个分区与sql是否匹配
|
boolean |
isShardSql(Partition partition,
String sql,
Object... preparedParams)
返回是否是分片语句
|
void |
setCache(Cache cache)
设置缓存
|
void |
setShardBalance(ShardBalance balance)
设置分片均衡器
|
boolean isShardSql(Partition partition, String sql, Object... preparedParams)
partition - sql - preparedParams - prepared参数,用于preparedStatementvoid addStatementProcessor(StatementProcessor statementProcessor)
statementProcessor - List<StatementProcessor> getStatementProcessorList()
<T> T getPrimaryKey(Router router, String tableName)
T - router - tableName - void addRouter(Router router)
router - void addRouters(Routers routers)
routers - boolean isMatch(Partition partition, Shard shard, String sql, Object... preparedParams)
shard - sql - preparedParams - prepared参数,用于preparedStatementString getSql(Partition partition, Shard shard, String sql, Object... preparedParams)
partition - shard - sql - preparedParams - prepared参数Collection<Partition> getPartitions(String routerId, String sql)
routerId - sql - List<Partition> getPartitions(Router router, String sql)
router - sql - List<Shard> getShards(Partition partition, String sql, Object... preparedParams)
partition - sql - preparedParams - prepared参数,用于preparedStatementShardBalance getShardBalance()
void setShardBalance(ShardBalance balance)
balance - void addRouters(String routerFilePath)
routerFilePath - void addRouters(InputStream inputStream)
inputStream - void setCache(Cache cache)
cache - Cache getCache()
Copyright © 2006–2015 TinyGroup. All rights reserved.