Delete unnecessary service IDs. Only services exposed to the wider network need this type of identifier.

This commit is contained in:
Mike Hearn 2016-04-20 15:28:59 +02:00
parent fcc36c472a
commit e88907dd41
4 changed files with 4 additions and 15 deletions

View File

@ -9,7 +9,6 @@ import java.security.PublicKey
* service would provide.
*/
interface IdentityService {
object Type : ServiceType("corda.identity")
fun partyFromKey(key: PublicKey): Party?
fun partyFromName(name: String): Party?
}

View File

@ -9,7 +9,9 @@
package core.node.services
/**
* Identifier for service types a node can expose.
* Identifier for service types a node can expose over the network to other peers. These types are placed into network
* map advertisements. Services that are purely local and are not providing functionality to other parts of the network
* don't need a declared service type.
*/
abstract class ServiceType(val id: String) {
init {
@ -28,6 +30,5 @@ abstract class ServiceType(val id: String) {
}
override fun hashCode(): Int = id.hashCode()
override fun toString(): String = id.toString()
}

View File

@ -1,11 +1,6 @@
package core.node.services
import core.Party
import core.crypto.DummyPublicKey
import core.messaging.SingleMessageRecipient
import core.node.NodeInfo
import core.node.PhysicalLocation
import java.util.*
/**
* A network map contains lists of nodes on the network along with information about their identity keys, services
@ -17,7 +12,6 @@ import java.util.*
* This interface assumes fast, synchronous access to an in-memory map.
*/
interface NetworkMapCache {
object Type : ServiceType("corda.network_map")
val timestampingNodes: List<NodeInfo>
val ratesOracleNodes: List<NodeInfo>
val partyNodes: List<NodeInfo>

View File

@ -47,7 +47,6 @@ data class Wallet(val states: List<StateAndRef<ContractState>>) {
* consumed by someone else first!
*/
interface WalletService {
object Type : ServiceType("corda.wallet")
/**
* Returns a read-only snapshot of the wallet at the time the call is made. Note that if you consume states or
* keys in this wallet, you must inform the wallet service so it can update its internal state.
@ -102,7 +101,6 @@ inline fun <reified T : LinearState> WalletService.linearHeadsOfType() = linearH
* interface if/when one is developed.
*/
interface KeyManagementService {
object Type : ServiceType("corda.key_management")
/** Returns a snapshot of the current pubkey->privkey mapping. */
val keys: Map<PublicKey, PrivateKey>
@ -118,7 +116,6 @@ interface KeyManagementService {
* anything like that, this interface is only big enough to support the prototyping work.
*/
interface StorageService {
object Type : ServiceType("corda.storage")
/**
* A map of hash->tx where tx has been signature/contract validated and the states are known to be correct.
* The signatures aren't technically needed after that point, but we keep them around so that we can relay
@ -143,9 +140,7 @@ interface StorageService {
* Provides access to various metrics and ways to notify monitoring services of things, for sysadmin purposes.
* This is not an interface because it is too lightweight to bother mocking out.
*/
class MonitoringService(val metrics: MetricRegistry) {
object Type : ServiceType("corda.monitoring")
}
class MonitoringService(val metrics: MetricRegistry)
/**
* A service hub simply vends references to the other services a node has. Some of those services may be missing or