private val logger: Logger = Logger.getLogger(IdentityLoader::class.java.name)
@Throws(WebOfTrustException::class)
private val logger: Logger = Logger.getLogger(IdentityLoader::class.java.name)
@Throws(WebOfTrustException::class)
time({ stopwatch, identities -> "Loaded ${identities.size} own identities in ${stopwatch.elapsed(MILLISECONDS) / 1000.0}s." }) {
webOfTrustConnector.loadAllOwnIdentities()
}.let(this::loadTrustedIdentitiesForOwnIdentities)
time({ stopwatch, identities -> "Loaded ${identities.size} own identities in ${stopwatch.elapsed(MILLISECONDS) / 1000.0}s." }) {
webOfTrustConnector.loadAllOwnIdentities()
}.let(this::loadTrustedIdentitiesForOwnIdentities)
private fun loadTrustedIdentitiesForOwnIdentities(ownIdentities: Collection<OwnIdentity>) =
ownIdentities.associateWith { ownIdentity ->
if (ownIdentity.doesNotHaveCorrectContext()) {
private fun loadTrustedIdentitiesForOwnIdentities(ownIdentities: Collection<OwnIdentity>) =
ownIdentities.associateWith { ownIdentity ->
if (ownIdentity.doesNotHaveCorrectContext()) {
} else {
time({ stopwatch, identities -> "Loaded ${identities.size} identities for ${ownIdentity.nickname} in ${stopwatch.elapsed(MILLISECONDS) / 1000.0}s." }) {
webOfTrustConnector.loadTrustedIdentities(ownIdentity, context?.context)
} else {
time({ stopwatch, identities -> "Loaded ${identities.size} identities for ${ownIdentity.nickname} in ${stopwatch.elapsed(MILLISECONDS) / 1000.0}s." }) {
webOfTrustConnector.loadTrustedIdentities(ownIdentity, context?.context)
private fun OwnIdentity.doesNotHaveCorrectContext() =
context?.let { it.context !in contexts } ?: false
private fun OwnIdentity.doesNotHaveCorrectContext() =
context?.let { it.context !in contexts } ?: false
Stopwatch.createStarted().let { stopwatch ->
loader().also { logger.fine(logMessage(stopwatch, it)) }
}
Stopwatch.createStarted().let { stopwatch ->
loader().also { logger.fine(logMessage(stopwatch, it)) }
}