diff --git a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy index b19ca890..64542ee4 100644 --- a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy @@ -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) { + + } } diff --git a/core/src/main/groovy/com/muwire/core/search/LeafSearcher.groovy b/core/src/main/groovy/com/muwire/core/search/LeafSearcher.groovy new file mode 100644 index 00000000..5ca76036 --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/search/LeafSearcher.groovy @@ -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> fileNameToHashes = new HashMap<>() + final Map> hashToLeafs = new HashMap<>() + + final Map>> 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 + } + +} diff --git a/core/src/main/groovy/com/muwire/core/search/UpsertEvent.groovy b/core/src/main/groovy/com/muwire/core/search/UpsertEvent.groovy index 3594ce2e..e3534c4f 100644 --- a/core/src/main/groovy/com/muwire/core/search/UpsertEvent.groovy +++ b/core/src/main/groovy/com/muwire/core/search/UpsertEvent.groovy @@ -7,7 +7,7 @@ import net.i2p.data.Destination class UpsertEvent extends Event { - List names + Set names byte [] infoHash Destination leaf