Package com.biglybt.pifimpl.local.ddb
Class DDBaseImpl
java.lang.Object
com.biglybt.pifimpl.local.ddb.DDBaseImpl
- All Implemented Interfaces:
DistributedDatabase
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
protected class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static AEMonitor
private final Core
private static Map<DHTPluginInterface,
DistributedDatabase> private DHTPluginInterface
private final String
private static boolean
private static DDBaseImpl
private final DDBaseTTTorrent
Fields inherited from interface com.biglybt.pif.ddb.DistributedDatabase
DT_FREQUENCY, DT_NONE, DT_SIZE, OP_EXHAUSTIVE_READ, OP_NONE, OP_PRIORITY_HIGH
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DDBaseImpl
(Core _core) protected
DDBaseImpl
(String _net, DHTPluginInterface _dht) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addTransferHandler
(DistributedDatabaseTransferType type, DistributedDatabaseTransferHandler handler) protected DistributedDatabaseValue
call
(DDBaseContactImpl contact, DistributedDatabaseProgressListener listener, DistributedDatabaseTransferType type, DistributedDatabaseValue value, long timeout) createValue
(Object value) void
delete
(DistributedDatabaseListener listener, DistributedDatabaseKey key) void
delete
(DistributedDatabaseListener listener, DistributedDatabaseKey key, DistributedDatabaseContact[] targets) static List<DistributedDatabase>
static List<DistributedDatabase>
static List<DistributedDatabase>
protected DHTPluginInterface
getDHT()
static DDBaseImpl
getSingleton
(Core core) getStandardTransferType
(int standard_type) Get all locally held (direct+indirect) values for a keyprotected DHTPluginInterface
grabDHT()
importContact
(InetSocketAddress address) importContact
(InetSocketAddress address, byte version) importContact
(InetSocketAddress address, byte version, int preferred_dht) importContact
(Map<String, Object> map) boolean
boolean
boolean
protected boolean
protected void
void
read
(DistributedDatabaseListener listener, DistributedDatabaseKey key, long timeout) void
read
(DistributedDatabaseListener listener, DistributedDatabaseKey key, long timeout, int options) protected DistributedDatabaseValue
read
(DDBaseContactImpl contact, DistributedDatabaseProgressListener listener, DistributedDatabaseTransferType type, DistributedDatabaseKey key, long timeout) void
readKeyStats
(DistributedDatabaseListener listener, DistributedDatabaseKey key, long timeout) void
protected void
void
write
(DistributedDatabaseListener listener, DistributedDatabaseKey key, DistributedDatabaseValue value) void
write
(DistributedDatabaseListener listener, DistributedDatabaseKey key, DistributedDatabaseValue[] values) protected void
write
(DDBaseContactImpl contact, DistributedDatabaseProgressListener listener, DistributedDatabaseTransferType type, DistributedDatabaseKey key, DistributedDatabaseValue value, long timeout)
-
Field Details
-
singleton
-
class_mon
-
transfer_map
-
prefer_i2p
private static boolean prefer_i2p -
dht_pi_map
-
core
-
torrent_transfer
-
network
-
dht_use_accessor
-
listeners
-
-
Constructor Details
-
DDBaseImpl
-
DDBaseImpl
-
-
Method Details
-
getSingleton
-
getDDBs
-
getDDBs
-
getDDBs
-
getNetwork
- Specified by:
getNetwork
in interfaceDistributedDatabase
-
getDHTPlugin
- Specified by:
getDHTPlugin
in interfaceDistributedDatabase
-
getTTTorrent
-
grabDHT
-
isAvailable
public boolean isAvailable()- Specified by:
isAvailable
in interfaceDistributedDatabase
-
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfaceDistributedDatabase
-
isExtendedUseAllowed
public boolean isExtendedUseAllowed()- Specified by:
isExtendedUseAllowed
in interfaceDistributedDatabase
-
isTorrentXferEnabled
protected boolean isTorrentXferEnabled() -
getLocalContact
- Specified by:
getLocalContact
in interfaceDistributedDatabase
-
throwIfNotAvailable
- Throws:
DistributedDatabaseException
-
getDHT
- Throws:
DistributedDatabaseException
-
log
-
createKey
- Specified by:
createKey
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
createKey
public DistributedDatabaseKey createKey(Object key, String description) throws DistributedDatabaseException - Specified by:
createKey
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
createValue
- Specified by:
createValue
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
importContact
public DistributedDatabaseContact importContact(InetSocketAddress address) throws DistributedDatabaseException - Specified by:
importContact
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
importContact
public DistributedDatabaseContact importContact(InetSocketAddress address, byte version) throws DistributedDatabaseException - Specified by:
importContact
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
importContact
public DistributedDatabaseContact importContact(InetSocketAddress address, byte version, int preferred_dht) throws DistributedDatabaseException - Specified by:
importContact
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
importContact
public DistributedDatabaseContact importContact(Map<String, Object> map) throws DistributedDatabaseException- Specified by:
importContact
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
write
public void write(DistributedDatabaseListener listener, DistributedDatabaseKey key, DistributedDatabaseValue value) throws DistributedDatabaseException - Specified by:
write
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
write
public void write(DistributedDatabaseListener listener, DistributedDatabaseKey key, DistributedDatabaseValue[] values) throws DistributedDatabaseException - Specified by:
write
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
read
public void read(DistributedDatabaseListener listener, DistributedDatabaseKey key, long timeout) throws DistributedDatabaseException - Specified by:
read
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
read
public void read(DistributedDatabaseListener listener, DistributedDatabaseKey key, long timeout, int options) throws DistributedDatabaseException - Specified by:
read
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
readKeyStats
public void readKeyStats(DistributedDatabaseListener listener, DistributedDatabaseKey key, long timeout) throws DistributedDatabaseException - Specified by:
readKeyStats
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
getValues
public List<DistributedDatabaseValue> getValues(DistributedDatabaseKey key) throws DistributedDatabaseException Description copied from interface:DistributedDatabase
Get all locally held (direct+indirect) values for a key- Specified by:
getValues
in interfaceDistributedDatabase
- Returns:
- Throws:
DistributedDatabaseException
-
delete
public void delete(DistributedDatabaseListener listener, DistributedDatabaseKey key) throws DistributedDatabaseException - Specified by:
delete
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
delete
public void delete(DistributedDatabaseListener listener, DistributedDatabaseKey key, DistributedDatabaseContact[] targets) throws DistributedDatabaseException - Specified by:
delete
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
addTransferHandler
public void addTransferHandler(DistributedDatabaseTransferType type, DistributedDatabaseTransferHandler handler) throws DistributedDatabaseException - Specified by:
addTransferHandler
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
getStandardTransferType
public DistributedDatabaseTransferType getStandardTransferType(int standard_type) throws DistributedDatabaseException - Specified by:
getStandardTransferType
in interfaceDistributedDatabase
- Throws:
DistributedDatabaseException
-
read
protected DistributedDatabaseValue read(DDBaseContactImpl contact, DistributedDatabaseProgressListener listener, DistributedDatabaseTransferType type, DistributedDatabaseKey key, long timeout) throws DistributedDatabaseException - Throws:
DistributedDatabaseException
-
write
protected void write(DDBaseContactImpl contact, DistributedDatabaseProgressListener listener, DistributedDatabaseTransferType type, DistributedDatabaseKey key, DistributedDatabaseValue value, long timeout) throws DistributedDatabaseException - Throws:
DistributedDatabaseException
-
call
protected DistributedDatabaseValue call(DDBaseContactImpl contact, DistributedDatabaseProgressListener listener, DistributedDatabaseTransferType type, DistributedDatabaseValue value, long timeout) throws DistributedDatabaseException - Throws:
DistributedDatabaseException
-
addListener
- Specified by:
addListener
in interfaceDistributedDatabase
-
removeListener
- Specified by:
removeListener
in interfaceDistributedDatabase
-