public class Connection extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected Cipher |
cipher |
protected Key |
key |
protected Net |
net |
protected NetType |
netType |
protected static ScheduledExecutorService |
scheduledService |
| 限定符 | 构造器和说明 |
|---|---|
protected |
Connection(String[] ipTable,
int port,
Key key,
String token,
Cipher cipher) |
protected |
Connection(String[] ipTable,
int port,
Key key,
String token,
Cipher cipher,
NetType netType) |
protected |
Connection(String[] ipArr,
int port,
String token,
long timeout,
String ksPath,
String ksPasswd)
DEFAULT_TIMEOUT
|
protected |
Connection(String[] ipArr,
int port,
String token,
long timeout,
String ksPath,
String ksPasswd,
NetType netType)
DEFAULT_TIMEOUT
|
protected |
Connection(String[] ipArr,
int port,
String token,
String ksPath,
String ksPasswd)
Description: 客户端构造器 , 默认超时为 DEFAULT_TIMEOUT
|
| 限定符和类型 | 方法和说明 |
|---|---|
BatchTrans<TransHead> |
addBatchTrans(BatchTrans<Trans> batch)
Description: 批量交易
|
TransHead |
addTrans(Trans trans)
Description: 添加一笔交易
|
protected void |
asynAskNodes(long timeout)
Description:异步同步节点信息
|
Block<Trans> |
getBlock(Long height)
Description: 根据块高度查询块信息
|
List<Node> |
getBlockChainNodeStatus()
Description: 获取当前系统全部节点的node对象集合
|
Block |
getBlockHeaderByHeight(Long height)
Description: 根据height查询block header
|
int |
getConnectionCount()
Description:获取当前区块链的连接数
|
String |
getId() |
Block<Trans> |
getMaxBlock()
Description: 查询最大块信息
|
protected RPCMessage |
getMessage() |
Trans |
getNewTransByKey(String key)
Description: 根据key维度查询交易
|
Long |
getTotalTransCount()
Description:查询交易总数量
|
Trans |
getTransByHash(String hash)
Description: 根据hash查询交易信息
|
List<Trans> |
getTransHistoryByKey(String key,
int startIndex,
int endIndex)
Description:根据key维度查询交易历史
|
List<Trans> |
getTransListByHashList(List<String> hashList)
Description: 根据hashlist查询交易
|
List<Trans> |
getTransListByType(String type)
Description:根据交易类type查询交易
|
protected void |
openNet(String[] ipArr,
int port,
String token)
Description:开启网络连接
|
protected void |
openNet(String[] ipArr,
int port,
String token,
Cipher cipher) |
protected void |
readyCert(String ksPath,
String ksPasswd)
Description:准备证书
|
boolean |
startTransaction(String[] keys)
Description:开启事务
|
void |
stopTransaction(String[] keys)
Description:关闭事务
|
protected Key key
protected Net net
protected NetType netType
protected Cipher cipher
protected static final ScheduledExecutorService scheduledService
protected Connection(String[] ipArr, int port, String token, String ksPath, String ksPasswd)
ipArr - port - token - ksPath - ksPasswd - protected Connection(String[] ipTable, int port, Key key, String token, Cipher cipher, NetType netType)
ipTable - port - key - token - cipher - protected Connection(String[] ipTable, int port, Key key, String token, Cipher cipher)
ipTable - port - key - token - cipher - protected Connection(String[] ipArr, int port, String token, long timeout, String ksPath, String ksPasswd)
ipArr - port - token - timeout - ksPath - ksPasswd - public BatchTrans<TransHead> addBatchTrans(BatchTrans<Trans> batch)
batch - public Block getBlockHeaderByHeight(Long height)
height - public Trans getTransByHash(String hash)
hash - public List<Trans> getTransListByHashList(List<String> hashList)
hashList - public Trans getNewTransByKey(String key)
key - public List<Trans> getTransListByType(String type)
type - public List<Trans> getTransHistoryByKey(String key, int startIndex, int endIndex)
key - startIndex - endIndex - public int getConnectionCount()
public boolean startTransaction(String[] keys)
keys - public void stopTransaction(String[] keys)
keys - public Long getTotalTransCount()
public List<Node> getBlockChainNodeStatus()
public String getId()
protected RPCMessage getMessage()
protected void openNet(String[] ipArr, int port, String token)
ipArr - port - token - protected void asynAskNodes(long timeout)
timeout - Copyright © 2019. All Rights Reserved.