T
- The ultimate type of the data being fetched.W
- The wire type of the data being fetched, for when it isn't the same as the ultimate type.public class FetchDataFlow<T extends NamedByHash,W>
extends FlowLogic
An abstract flow for fetching typed data from a remote peer.
Given a set of hashes (IDs), either loads them from local disk or asks the remote peer to provide them.
A malicious response in which the data provided by the remote peer does not hash to the requested hash results in
exception FetchDataFlow.DownloadedVsRequestedDataMismatch
being thrown. If the remote peer doesn't have an entry, it results in a
exception FetchDataFlow.HashNotFound
exception being thrown.
By default this class does not insert data into any local database, if you want to do that after missing items were
fetched then override maybeWriteToDisk. You must override FetchDataFlow.load
. If the wire type is not the same as the
ultimate type, you must also override convert.
Modifier and Type | Class and Description |
---|---|
static class |
FetchDataFlow.Request |
static class |
FetchDataFlow.Result<T extends NamedByHash> |
Constructor and Description |
---|
FetchDataFlow(java.util.Set<? extends net.corda.core.crypto.SecureHash> requests,
Party otherSide)
An abstract flow for fetching typed data from a remote peer.
|
Modifier and Type | Method and Description |
---|---|
FetchDataFlow.Result<T> |
call()
This is where you fill out your business logic. The returned object will usually be ignored, but can be
helpful if this flow is meant to be used as a subflow.
|
T |
convert(W wire) |
Party |
getOtherSide() |
java.util.Set<net.corda.core.crypto.SecureHash> |
getRequests() |
T |
load(SecureHash txid) |
void |
maybeWriteToDisk(java.util.List<? extends T> downloaded) |
call, getCounterpartyMarker, getLogger, getProgressTracker, getRunId, getServiceHub, getStateMachine, receive, send, sendAndReceive, setStateMachine, subFlow, subFlow, track
public FetchDataFlow(java.util.Set<? extends net.corda.core.crypto.SecureHash> requests, Party otherSide)
An abstract flow for fetching typed data from a remote peer.
Given a set of hashes (IDs), either loads them from local disk or asks the remote peer to provide them.
A malicious response in which the data provided by the remote peer does not hash to the requested hash results in
exception FetchDataFlow.DownloadedVsRequestedDataMismatch
being thrown. If the remote peer doesn't have an entry, it results in a
exception FetchDataFlow.HashNotFound
exception being thrown.
By default this class does not insert data into any local database, if you want to do that after missing items were
fetched then override maybeWriteToDisk. You must override FetchDataFlow.load
. If the wire type is not the same as the
ultimate type, you must also override convert.
public FetchDataFlow.Result<T> call()
This is where you fill out your business logic. The returned object will usually be ignored, but can be helpful if this flow is meant to be used as a subflow.
public void maybeWriteToDisk(java.util.List<? extends T> downloaded)
public T load(SecureHash txid)
public T convert(W wire)
public java.util.Set<net.corda.core.crypto.SecureHash> getRequests()
public Party getOtherSide()