mirror of
https://github.com/corda/corda.git
synced 2025-04-08 03:44:49 +00:00
Add explanation to NetworkMapCache docs. (#1727)
NodeInfo lookup can return more than one node for distribute services.
This commit is contained in:
parent
2704165d7a
commit
cac739e48d
@ -271,6 +271,8 @@ interface CordaRPCOps : RPCOps {
|
||||
|
||||
/**
|
||||
* Returns a node's info from the network map cache, where known.
|
||||
* Notice that when there are more than one node for a given name (in case of distributed services) first service node
|
||||
* found will be returned.
|
||||
*
|
||||
* @return the node info if available.
|
||||
*/
|
||||
|
@ -50,6 +50,8 @@ interface NetworkMapCache {
|
||||
* Look up the node info for a specific party. Will attempt to de-anonymise the party if applicable; if the party
|
||||
* is anonymised and the well known party cannot be resolved, it is impossible ot identify the node and therefore this
|
||||
* returns null.
|
||||
* Notice that when there are more than one node for a given party (in case of distributed services) first service node
|
||||
* found will be returned. See also: [getNodesByLegalIdentityKey].
|
||||
*
|
||||
* @param party party to retrieve node information for.
|
||||
* @return the node for the identity, or null if the node could not be found. This does not necessarily mean there is
|
||||
@ -57,7 +59,11 @@ interface NetworkMapCache {
|
||||
*/
|
||||
fun getNodeByLegalIdentity(party: AbstractParty): NodeInfo?
|
||||
|
||||
/** Look up the node info for a legal name. */
|
||||
/**
|
||||
* Look up the node info for a legal name.
|
||||
* Notice that when there are more than one node for a given name (in case of distributed services) first service node
|
||||
* found will be returned.
|
||||
*/
|
||||
fun getNodeByLegalName(name: CordaX500Name): NodeInfo?
|
||||
|
||||
/** Look up the node info for a host and port. */
|
||||
|
@ -112,7 +112,7 @@ open class PersistentNetworkMapCache(private val serviceHub: ServiceHubInternal)
|
||||
override fun getNodeByLegalIdentity(party: AbstractParty): NodeInfo? {
|
||||
val wellKnownParty = serviceHub.identityService.wellKnownPartyFromAnonymous(party)
|
||||
return wellKnownParty?.let {
|
||||
getNodesByLegalIdentityKey(it.owningKey).singleOrNull()
|
||||
getNodesByLegalIdentityKey(it.owningKey).firstOrNull()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user