Add registry method for deciding which contacts to poll.

This commit is contained in:
akwizgran
2020-05-13 17:55:05 +01:00
parent 2919657b4a
commit d3d7212b08
9 changed files with 106 additions and 7 deletions

View File

@@ -40,6 +40,12 @@ public interface ConnectionRegistry {
*/
Collection<ContactId> getConnectedContacts(TransportId t);
/**
* Returns any contacts that are connected via the given transport, or via
* any transport that's preferred to the given transport.
*/
Collection<ContactId> getConnectedOrPreferredContacts(TransportId t);
/**
* Returns true if the given contact is connected via the given transport.
*/

View File

@@ -1,10 +1,12 @@
package org.briarproject.bramble.api.plugin;
import org.briarproject.bramble.api.Pair;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.plugin.duplex.DuplexPluginFactory;
import org.briarproject.bramble.api.plugin.simplex.SimplexPluginFactory;
import java.util.Collection;
import java.util.List;
@NotNullByDefault
public interface PluginConfig {
@@ -14,4 +16,10 @@ public interface PluginConfig {
Collection<SimplexPluginFactory> getSimplexFactories();
boolean shouldPoll();
/**
* Returns a list of transport preferences. For each pair in the list,
* the first transport is preferred to the second.
*/
List<Pair<TransportId, TransportId>> getTransportPreferences();
}