mirror of
https://github.com/corda/corda.git
synced 2024-12-30 01:39:04 +00:00
Merged in rnicoll-remove-deregister-identity (pull request #70)
Remove deregisterIdentity()
This commit is contained in:
commit
120f99f0a6
@ -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?
|
||||||
}
|
}
|
||||||
|
@ -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]
|
||||||
}
|
}
|
@ -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]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user