public class Connection extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
account |
protected Cipher |
cipher |
protected String |
connectionId |
protected Key |
key |
protected Net |
net |
protected String |
role |
protected static ScheduledExecutorService |
scheduledService |
protected long |
timeout |
| 限定符 | 构造器和说明 |
|---|---|
protected |
Connection(String[] ipTable,
int port,
Key key,
String token,
Cipher cipher) |
protected |
Connection(String[] ipTable,
int port,
Key key,
String token,
Cipher cipher,
long timeout) |
protected |
Connection(String[] ipArr,
int port,
String token,
long timeout,
String ksPath,
String ksPasswd,
Cipher cipher)
DEFAULT_TIMEOUT
|
protected |
Connection(String[] ipArr,
int port,
String token,
String ksPath,
String ksPasswd,
Cipher cipher)
Description: 客户端构造器 , 默认超时为 DEFAULT_TIMEOUT
|
| 限定符和类型 | 方法和说明 |
|---|---|
Result<BatchTrans<TransHead>> |
addBatchTrans(BatchTrans<Trans> batch)
Description: 批量交易
|
Result<TransHead> |
addPermissionTrans(Permission permission)
Description: 添加一笔系统权限交(只有管理员证书才能使用)
|
Result<TransHead> |
addTrans(Trans trans)
Description: 添加一笔交易
|
protected void |
asynAskNodes(long timeout)
Description:异步同步节点信息
|
String |
getAccount() |
Result<Block<Trans>> |
getBlock(long height)
Description: 根据块高度查询块信息
|
List<Node> |
getBlockChainNodeList()
Description: 获取当前系统全部节点的node对象集合
|
Result<Long> |
getBlockChainTransCount()
Description:查询区块链交易总数
|
Result<BlockHead> |
getBlockHead(long height)
Description: 根据height查询block header
|
Result<List<BlockHead>> |
getBlockHeadList(long startHeight,
long endHeight)
Description: 根据块高度查询块信息
|
Result<Integer> |
getConnectionCount()
Description:获取当前区块链的连接数
|
String |
getId() |
Result<Block<Trans>> |
getMaxBlock()
Description: 查询最大块信息
|
Result<BlockHead> |
getMaxBlockHead()
Description: 查询最大的块header,不包含交易
|
Result<Trans> |
getNewSystemTransByKey(String key)
Description: 根据key获取系统交易(只有管理员才能使用该方法,使用该方法只能查询系统交易,查询普通交易请使用getNewTransByKey)
|
Result<Trans> |
getNewTransByAccountAndKey(String account,
String key)
Description:根据account和key获取最新交易
|
Result<BQLResult> |
getNewTransByBQL(BQL bql)
Description: 根据BlockChain Query Langage 区块链面向对象查询语言的查询条件获取对应key上的最新版本交易
|
Result<Trans> |
getNewTransByKey(String key)
Description: 根据key维度查询交易
|
Result<Integer> |
getNewTransCount()
Description:查询当前账户下的交易总数
|
Result<Integer> |
getNewTransCountByAccount(String account)
Description:查询账户account下的交易总数
|
Result<List<Trans>> |
getNewTransList(int limit,
int offset)
Description:查询当前账户下的交易集合
|
Result<List<TransHead>> |
getNewTransListByAccount(String account)
Description: 获取account的最新交易
|
Result<List<Trans>> |
getNewTransListByAccount(String account,
int limit,
int offset)
Description:查询账户account下的交易集合
|
Result<List<Trans>> |
getNewTransListByAccountAndKeys(String account,
List<String> keys)
Description: 根据account和key集合获取交易
|
Result<List<Trans>> |
getNewTransListByKeys(List<String> keys)
Description: 根据key集合获取交易
查询自己的交易
|
Result<Trans> |
getPermissionTrans()
Description:查询系统权限交易(管理员才能读取)
|
String |
getRole() |
Result<Trans> |
getTransByAccountAndHash(String account,
String hash)
Description: 根据hash和账户查询交易信息
|
Result<Trans> |
getTransByHash(String hash)
Description: 根据hash查询交易信息
|
Result<Integer> |
getTransCountByAccountAndType(String account,
String type)
根据交易类type和account查询交易数量
|
Result<List<Trans>> |
getTransHistoryByAccountAndKey(String account,
String key,
int startIndex,
int endIndex)
根据account 和key查询历史
|
Result<List<Trans>> |
getTransHistoryByKey(String key,
int startIndex,
int endIndex)
Description:根据key维度查询交易历史
|
Result<List<Trans>> |
getTransListByAccountAndType(String account,
String type,
int limit,
int offset)
根据交易类type和account查询交易
|
Result<List<Trans>> |
getTransListByHashList(List<String> hashList)
Description: 根据hashlist查询交易
|
Result<List<Trans>> |
getTransListByType(String type)
根据交易类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 String connectionId
protected Cipher cipher
protected String account
protected String role
protected long timeout
protected static final ScheduledExecutorService scheduledService
protected Connection(String[] ipArr, int port, String token, String ksPath, String ksPasswd, Cipher cipher)
ipArr - port - token - ksPath - ksPasswd - cipher - protected Connection(String[] ipTable, int port, Key key, String token, Cipher cipher)
ipTable - port - key - token - cipher - protected Connection(String[] ipTable, int port, Key key, String token, Cipher cipher, long timeout)
ipTable - port - key - token - cipher - timeout - public Result<TransHead> addTrans(Trans trans)
trans - public Result<TransHead> addPermissionTrans(Permission permission)
permission - public Result<Trans> getNewSystemTransByKey(String key)
key - public Result<BQLResult> getNewTransByBQL(BQL bql)
bql - BQLpublic Result<BatchTrans<TransHead>> addBatchTrans(BatchTrans<Trans> batch)
batch - public Result<Block<Trans>> getBlock(long height)
height - public Result<BlockHead> getBlockHead(long height)
height - public Result<List<BlockHead>> getBlockHeadList(long startHeight, long endHeight)
public Result<BlockHead> getMaxBlockHead()
public Result<Trans> getTransByHash(String hash)
hash - public Result<Trans> getTransByAccountAndHash(String account, String hash)
hash - account - public Result<List<Trans>> getTransListByHashList(List<String> hashList)
hashList - public Result<Trans> getNewTransByKey(String key)
key - public Result<List<Trans>> getTransListByType(String type)
type - public Result<List<Trans>> getTransListByAccountAndType(String account, String type, int limit, int offset)
type - account - public Result<Integer> getTransCountByAccountAndType(String account, String type)
type - account - public Result<List<Trans>> getTransHistoryByAccountAndKey(String account, String key, int startIndex, int endIndex)
account - key - public Result<List<Trans>> getTransHistoryByKey(String key, int startIndex, int endIndex)
key - startIndex - endIndex - public Result<Integer> getNewTransCountByAccount(String account)
public Result<List<Trans>> getNewTransListByAccount(String account, int limit, int offset)
public Result<List<Trans>> getNewTransList(int limit, int offset)
public boolean startTransaction(String[] keys)
keys - public void stopTransaction(String[] keys)
keys - public Result<Long> getBlockChainTransCount()
public Result<Trans> getNewTransByAccountAndKey(String account, String key)
public List<Node> getBlockChainNodeList()
public Result<List<TransHead>> getNewTransListByAccount(String account)
public Result<List<Trans>> getNewTransListByAccountAndKeys(String account, List<String> keys)
public Result<List<Trans>> getNewTransListByKeys(List<String> keys)
public String getId()
protected void openNet(String[] ipArr, int port, String token)
ipArr - port - token - protected void asynAskNodes(long timeout)
timeout - protected void readyCert(String ksPath, String ksPasswd)
ksPath - ksPasswd - public String getAccount()
public String getRole()
Copyright © 2020. All Rights Reserved.