我想检索时间x
之后我的节点记录的所有状态。自那时以来,如何获得我的节点记录的所有状态的流?
答案 0 :(得分:0)
这是一个示例RPC客户端,它在时间x
之后流回该节点存储的所有状态:
fun main(args: Array<String>) {
// Getting an RPC connection to the node.
require(args.size == 2) { "Usage: ExampleClientRPC <node address> <time>" }
val nodeAddress = NetworkHostAndPort.parse(args[0])
val client = CordaRPCClient(nodeAddress)
val rpcOps = client.start("user1", "test").proxy
val startTime = Instant.parse(args[2])
val queryAfterTimeExpression = TimeCondition(
RECORDED, BinaryComparison(GREATER_THAN_OR_EQUAL, startTime))
val queryAfterTimeCriteria = VaultQueryCriteria(
status = Vault.StateStatus.ALL,
timeCondition = queryAfterTimeExpression)
val queryAfterTimeResults = rpcOps.vaultTrackBy<ContractState>(queryAfterTimeCriteria)
val afterTimeStates = queryAfterTimeResults.updates
}