core.node.subsystems / NetworkMapCache

# NetworkMapCache

`interface 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.

### Properties

networkMapNodes | `abstract val networkMapNodes: List<NodeInfo>` A list of nodes that advertise a network map service
partyNodes | `abstract val partyNodes: List<NodeInfo>` A list of all nodes the cache is aware of
ratesOracleNodes | `abstract val ratesOracleNodes: List<NodeInfo>` A list of nodes that advertise a rates oracle service
regulators | `abstract val regulators: List<NodeInfo>` A list of nodes that advertise a regulatory service. Identifying the correct regulator for a trade is outwith the scope of the network map service, and this is intended solely as a sanity check on configuration stored elsewhere.
timestampingNodes | `abstract val timestampingNodes: List<NodeInfo>` A list of nodes that advertise a timestamping service

### Functions

addMapService | `abstract fun addMapService(smm: StateMachineManager, net: MessagingService, service: NodeInfo, subscribe: Boolean, ifChangedSinceVer: Int? = null): <ERROR CLASS><Unit>` Add a network map service; fetches a copy of the latest map from the service and subscribes to any further updates.
addNode | `abstract fun addNode(node: NodeInfo): Unit` Adds a node to the local cache (generally only used for adding ourselves)
deregisterForUpdates | `abstract fun deregisterForUpdates(smm: StateMachineManager, net: MessagingService, service: NodeInfo): <ERROR CLASS><Unit>` Deregister from updates from the given map service.
get | `abstract fun get(): Collection<NodeInfo>` Get a copy of all nodes in the map. `abstract fun get(serviceType: ServiceType): Collection<NodeInfo>` Get the collection of nodes which advertise a specific service.
getRecommended | `abstract fun getRecommended(type: ServiceType, contract: Contract, vararg party: Party): NodeInfo?` 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.
nodeForPartyName | `open fun nodeForPartyName(name: String): NodeInfo?` Look up the node info for a party.
removeNode | `abstract fun removeNode(node: NodeInfo): Unit` Removes a node from the local cache

### Companion Object Properties

logger | `val logger: <ERROR CLASS>`

### Inheritors

InMemoryNetworkMapCache | `open class InMemoryNetworkMapCache : NetworkMapCache` Extremely simple in-memory cache of the network map.