Merged in rnicoll-remove-deregister-identity (pull request #70)

Remove deregisterIdentity()
This commit is contained in:
Ross Nicoll 2016-04-27 13:13:21 +01:00
commit 120f99f0a6
3 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,11 @@ import java.security.PublicKey
*/ */
interface IdentityService { interface IdentityService {
fun registerIdentity(party: Party) fun registerIdentity(party: Party)
fun deregisterIdentity(party: Party)
// There is no method for removing identities, as once we are made aware of a Party we want to keep track of them
// indefinitely. It may be that in the long term we need to drop or archive very old Party information for space,
// but for now this is not supported.
fun partyFromKey(key: PublicKey): Party? fun partyFromKey(key: PublicKey): Party?
fun partyFromName(name: String): Party? fun partyFromName(name: String): Party?
} }

View File

@ -17,10 +17,7 @@ class InMemoryIdentityService() : IdentityService {
keyToParties[party.owningKey] = party keyToParties[party.owningKey] = party
nameToParties[party.name] = party nameToParties[party.name] = party
} }
override fun deregisterIdentity(party: Party) {
keyToParties.remove(party.owningKey)
nameToParties.remove(party.name)
}
override fun partyFromKey(key: PublicKey): Party? = keyToParties[key] override fun partyFromKey(key: PublicKey): Party? = keyToParties[key]
override fun partyFromName(name: String): Party? = nameToParties[name] override fun partyFromName(name: String): Party? = nameToParties[name]
} }

View File

@ -19,7 +19,6 @@ class MockIdentityService(val identities: List<Party>) : IdentityService {
get() = synchronized(identities) { identities.associateBy { it.name } } get() = synchronized(identities) { identities.associateBy { it.name } }
override fun registerIdentity(party: Party) { throw UnsupportedOperationException() } override fun registerIdentity(party: Party) { throw UnsupportedOperationException() }
override fun deregisterIdentity(party: Party) { throw UnsupportedOperationException() }
override fun partyFromKey(key: PublicKey): Party? = keyToParties[key] override fun partyFromKey(key: PublicKey): Party? = keyToParties[key]
override fun partyFromName(name: String): Party? = nameToParties[name] override fun partyFromName(name: String): Party? = nameToParties[name]
} }