@ThreadSafe open class InMemoryNetworkMapCache : SingletonSerializeAsToken, NetworkMapCache
Extremely simple in-memory cache of the network map.
<init> |
InMemoryNetworkMapCache()
Extremely simple in-memory cache of the network map. |
changed |
open val changed: Observable<MapChange>
Tracks changes to the network map cache |
mapServiceRegistered |
open val mapServiceRegistered: ListenableFuture<Unit>
Future to track completion of the NetworkMapService registration. |
networkMapNodes |
open val networkMapNodes: List<NodeInfo>
A list of nodes that advertise a network map service |
partyNodes |
open val partyNodes: List<NodeInfo>
A list of all nodes the cache is aware of |
registeredNodes |
var registeredNodes: MutableMap<Party, NodeInfo> |
notaryNodes |
open val notaryNodes: List<NodeInfo>
A list of nodes that advertise a notary service |
regulatorNodes |
open val regulatorNodes: List<NodeInfo>
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. |
addMapService |
open fun addMapService(net: MessagingService, networkMapAddress: SingleMessageRecipient, subscribe: Boolean, ifChangedSinceVer: Int?): ListenableFuture<Unit>
Add a network map service; fetches a copy of the latest map from the service and subscribes to any further updates. |
addNode |
open fun addNode(node: NodeInfo): Unit
Adds a node to the local cache (generally only used for adding ourselves). |
deregisterForUpdates |
open fun deregisterForUpdates(net: MessagingService, service: NodeInfo): ListenableFuture<Unit>
Unsubscribes from updates from the given map service. |
getPartyInfo |
open fun getPartyInfo(party: Party): PartyInfo?
Returns information about the party, which may be a specific node or a service |
processUpdatePush |
fun processUpdatePush(req: Update): Unit |
removeNode |
open fun removeNode(node: NodeInfo): Unit
Removes a node from the local cache. |
runWithoutMapService |
open fun runWithoutMapService(): Unit
For testing where the network map cache is manipulated marks the service as immediately ready. |
track |
open fun track(): Pair<List<NodeInfo>, Observable<MapChange>>
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. |
getAnyNotary |
open fun getAnyNotary(type: ServiceType? = null): Party?
Returns a notary identity advertised by any of the nodes on the network (chosen at random) |
getNodeByLegalIdentityKey |
open fun getNodeByLegalIdentityKey(compositeKey: CompositeKey): NodeInfo?
Look up the node info for a specific peer key. |
getNodeByLegalName |
open fun getNodeByLegalName(name: String): NodeInfo?
Look up the node info for a legal name. |
getNodesByAdvertisedServiceIdentityKey |
open fun getNodesByAdvertisedServiceIdentityKey(compositeKey: CompositeKey): List<NodeInfo>
Look up all nodes advertising the service owned by compositeKey |
getNodesWithService |
open fun getNodesWithService(serviceType: ServiceType): List<NodeInfo>
Get the collection of nodes which advertise a specific service. |
getNotary |
open fun getNotary(name: String): Party?
Gets a notary identity by the given name. |
getRecommended |
open 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. |
isNotary |
open fun isNotary(party: Party): Boolean
Checks whether a given party is an advertised notary identity |
toToken |
open fun toToken(context: SerializeAsTokenContext): SerializationToken |
logger |
val logger: Logger |