skeleton of leaf searcher

This commit is contained in:
Zlatin Balevsky
2018-08-03 23:31:52 +01:00
parent 76b190b742
commit 3a2fad4816
3 changed files with 44 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import java.util.concurrent.ConcurrentHashMap
import com.muwire.core.EventBus
import com.muwire.core.hostcache.HostCache
import com.muwire.core.search.QueryEvent
import groovy.util.logging.Log
import net.i2p.data.Destination
@@ -81,4 +82,8 @@ class UltrapeerConnectionManager extends ConnectionManager {
if (removed == null)
log.severe("Removed connection not present in either leaf or peer map ${e.destination.toBase32()}")
}
void forwardQueryToLeaf(Destination leaf, QueryEvent e) {
}
}

View File

@@ -0,0 +1,38 @@
package com.muwire.core.search
import com.muwire.core.connection.DisconnectionEvent
import com.muwire.core.connection.UltrapeerConnectionManager
import net.i2p.data.Destination
class LeafSearcher {
final UltrapeerConnectionManager connectionManager
final SearchIndex searchIndex = new SearchIndex()
final Map<String, Set<byte[]>> fileNameToHashes = new HashMap<>()
final Map<byte[], Set<Destination>> hashToLeafs = new HashMap<>()
final Map<Destination, Map<byte[], Set<String>>> leafToFiles = new HashMap<>()
LeafSearcher(UltrapeerConnectionManager connectionManager) {
this.connectionManager = connectionManager
}
void onUpsertEvent(UpsertEvent e) {
// TODO: implement
}
void onDeleteEvent(DeleteEvent e) {
// TODO: implement
}
void onDisconnectionEvent(DisconnectionEvent e) {
// TODO: implement
}
void onQueryEvent(QueryEvent e) {
// TODO: implement
}
}

View File

@@ -7,7 +7,7 @@ import net.i2p.data.Destination
class UpsertEvent extends Event {
List<String> names
Set<String> names
byte [] infoHash
Destination leaf