🔊 Log how much trust-all would reduce identity amount
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Apr 2020 18:14:36 +0000 (20:14 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Apr 2020 18:14:36 +0000 (20:14 +0200)
src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt

index 67e70e0..5f087c7 100644 (file)
@@ -58,6 +58,13 @@ class IdentityManagerImpl @Inject constructor(
                        try {
                                val currentIdentities = identityLoader.loadIdentities()
 
+                               val onlyTrustedByAll = currentIdentities.mapValues { (ownIdentity, trustedIdentities) ->
+                                       trustedIdentities.filter { trustedIdentity ->
+                                               currentIdentities.all { trustedIdentity in it.value }
+                                       }
+                               }
+                               logger.log(Level.FINE, "Reduced (${currentIdentities.size},(${currentIdentities.values.joinToString { it.size.toString() }})) identities to (${onlyTrustedByAll.size},(${onlyTrustedByAll.values.joinToString { it.size.toString() }})).")
+
                                val identityChangeEventSender = IdentityChangeEventSender(eventBus, oldIdentities)
                                identityChangeEventSender.detectChanges(currentIdentities)