public NetworkMapCache
A network map contains lists of nodes on the network along with information about their identity keys, services they provide and host names or IP addresses where they can be connected to. The cache wraps around a map fetched from an authoritative service, and adds easy lookup of the data stored within it. Generally it would be initialised with a specified network map service, which it fetches data from and then subscribes to updates of.
Modifier and Type | Interface and Description |
---|---|
static class |
NetworkMapCache.DefaultImpls
A network map contains lists of nodes on the network along with information about their identity keys, services
they provide and host names or IP addresses where they can be connected to. The cache wraps around a map fetched
from an authoritative service, and adds easy lookup of the data stored within it. Generally it would be initialised
with a specified network map service, which it fetches data from and then subscribes to updates of.
|
static class |
NetworkMapCache.MapChange |
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> |
addMapService(MessagingService net,
SingleMessageRecipient networkMapAddress,
boolean subscribe,
java.lang.Integer ifChangedSinceVer)
Add a network map service; fetches a copy of the latest map from the service and subscribes to any further
updates.
|
void |
addNode(NodeInfo node)
Adds a node to the local cache (generally only used for adding ourselves).
|
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> |
deregisterForUpdates(MessagingService net,
NodeInfo service)
Deregister from updates from the given map service.
|
Party |
getAnyNotary(ServiceType type)
Returns a notary identity advertised by any of the nodes on the network (chosen at random)
|
rx.Observable<net.corda.core.node.services.NetworkMapCache.MapChange> |
getChanged()
Tracks changes to the network map cache
|
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> |
getMapServiceRegistered()
Future to track completion of the NetworkMapService registration.
|
java.util.List<net.corda.core.node.NodeInfo> |
getNetworkMapNodes()
A list of nodes that advertise a network map service
|
NodeInfo |
getNodeByLegalIdentityKey(CompositeKey compositeKey)
Look up the node info for a specific peer key.
|
NodeInfo |
getNodeByLegalName(java.lang.String name)
Look up the node info for a legal name.
|
java.util.List<net.corda.core.node.NodeInfo> |
getNodesByAdvertisedServiceIdentityKey(CompositeKey compositeKey)
Look up all nodes advertising the service owned by compositeKey
|
java.util.List<net.corda.core.node.NodeInfo> |
getNodesWithService(ServiceType serviceType)
Get the collection of nodes which advertise a specific service.
|
Party |
getNotary(java.lang.String name)
Gets a notary identity by the given name.
|
java.util.List<net.corda.core.node.NodeInfo> |
getNotaryNodes()
A list of nodes that advertise a notary service
|
PartyInfo |
getPartyInfo(Party party)
Returns information about the party, which may be a specific node or a service
|
java.util.List<net.corda.core.node.NodeInfo> |
getPartyNodes()
A list of all nodes the cache is aware of
|
NodeInfo |
getRecommended(ServiceType type,
Contract contract,
net.corda.core.crypto.Party party)
Get a recommended node that advertises a service, and is suitable for the specified contract and parties.
Implementations might understand, for example, the correct regulator to use for specific contracts/parties,
or the appropriate oracle for a contract.
|
java.util.List<net.corda.core.node.NodeInfo> |
getRegulatorNodes()
A list of nodes that advertise a regulatory service. Identifying the correct regulator for a trade is outside
the scope of the network map service, and this is intended solely as a sanity check on configuration stored
elsewhere.
|
boolean |
isNotary(Party party)
Checks whether a given party is an advertised notary identity
|
void |
removeNode(NodeInfo node)
Removes a node from the local cache.
|
void |
runWithoutMapService()
For testing where the network map cache is manipulated marks the service as immediately ready.
|
kotlin.Pair<java.util.List,rx.Observable> |
track()
Atomically get the current party nodes and a stream of updates. Note that the Observable buffers updates until the
first subscriber is registered so as to avoid racing with early updates.
|
java.util.List<net.corda.core.node.NodeInfo> getPartyNodes()
A list of all nodes the cache is aware of
java.util.List<net.corda.core.node.NodeInfo> getNetworkMapNodes()
A list of nodes that advertise a network map service
java.util.List<net.corda.core.node.NodeInfo> getNotaryNodes()
A list of nodes that advertise a notary service
java.util.List<net.corda.core.node.NodeInfo> getRegulatorNodes()
A list of nodes that advertise a regulatory service. Identifying the correct regulator for a trade is outside the scope of the network map service, and this is intended solely as a sanity check on configuration stored elsewhere.
rx.Observable<net.corda.core.node.services.NetworkMapCache.MapChange> getChanged()
Tracks changes to the network map cache
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> getMapServiceRegistered()
Future to track completion of the NetworkMapService registration.
kotlin.Pair<java.util.List,rx.Observable> track()
Atomically get the current party nodes and a stream of updates. Note that the Observable buffers updates until the first subscriber is registered so as to avoid racing with early updates.
java.util.List<net.corda.core.node.NodeInfo> getNodesWithService(ServiceType serviceType)
Get the collection of nodes which advertise a specific service.
NodeInfo getRecommended(ServiceType type, Contract contract, net.corda.core.crypto.Party party)
Get a recommended node that advertises a service, and is suitable for the specified contract and parties. Implementations might understand, for example, the correct regulator to use for specific contracts/parties, or the appropriate oracle for a contract.
NodeInfo getNodeByLegalName(java.lang.String name)
Look up the node info for a legal name.
NodeInfo getNodeByLegalIdentityKey(CompositeKey compositeKey)
Look up the node info for a specific peer key.
java.util.List<net.corda.core.node.NodeInfo> getNodesByAdvertisedServiceIdentityKey(CompositeKey compositeKey)
Look up all nodes advertising the service owned by compositeKey
PartyInfo getPartyInfo(Party party)
Returns information about the party, which may be a specific node or a service
Party getNotary(java.lang.String name)
Gets a notary identity by the given name.
Party getAnyNotary(ServiceType type)
Returns a notary identity advertised by any of the nodes on the network (chosen at random)
type
- Limits the result to notaries of the specified type (optional)boolean isNotary(Party party)
Checks whether a given party is an advertised notary identity
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> addMapService(MessagingService net, SingleMessageRecipient networkMapAddress, boolean subscribe, java.lang.Integer ifChangedSinceVer)
Add a network map service; fetches a copy of the latest map from the service and subscribes to any further updates.
net
- the network messaging service.networkMapAddress
- the network map service to fetch current state from.subscribe
- if the cache should subscribe to updates.ifChangedSinceVer
- an optional version number to limit updating the map based on. If the latest map
version is less than or equal to the given version, no update is fetched.void addNode(NodeInfo node)
Adds a node to the local cache (generally only used for adding ourselves).
void removeNode(NodeInfo node)
Removes a node from the local cache.
com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> deregisterForUpdates(MessagingService net, NodeInfo service)
Deregister from updates from the given map service.
net
- the network messaging service.service
- the network map service to fetch current state from.void runWithoutMapService()
For testing where the network map cache is manipulated marks the service as immediately ready.