Package com.biglybt.core.content
Class RelatedContentManager
java.lang.Object
com.biglybt.core.content.RelatedContentManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
protected static class
protected class
protected static class
protected static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
(package private) RelatedContentManager.RCMSearchXFerBiglyBT
private static final int
private static final String
private static final int
private static final int
private static final int
private static final int
private static final String
private AsyncDispatcher
private boolean
private int
private static Core
private static final boolean
private final boolean
static final long
private boolean
private long
private Map<Byte,
DHTPluginBasicInterface> private static final int
private static final int
private static final int
private static final int
(package private) AESemaphore
private long
private boolean
(package private) CopyOnWriteList<RelatedContentManagerListener>
(package private) RelatedContentManager.RCMSearchXFer
private static final int
private static final int
private static final int
private int
private int
private static final int
private static final int
private static final int
private static final int
private RelatedContentSearcher
protected static final byte
private static final String[]
protected static final byte
protected static final byte
private static final String[]
private static final String[]
protected static final byte
private static final String[]
private static final int
private static final int
(package private) boolean
private BloomFilter
private static final String
private PluginInterface
private static boolean
private DHTPluginBasicInterface
private DHTPluginBasicInterface
private static final int
private static final int
private static final int
private static final int
private int
protected final Object
static final int
static final int
static final int
static final int
private static final int
private static final int
(package private) final CopyOnWriteList<RelatedContentSearcher>
private static final int
(package private) long
(package private) boolean
private static final int
private static final int
(package private) LinkedList<RelatedContentManager.SecondaryLookup>
private static RelatedContentManager
private TorrentAttribute
private TorrentAttribute
private TagManager
private AtomicInteger
private static final int
protected static final int
private AtomicInteger
private static final boolean
protected static Map<String,
RelatedContentManager.DownloadInfo> private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDownloads
(Download[] downloads, boolean initialising) void
addListener
(RelatedContentManagerListener listener) protected void
addPersistentlyDeleted
(RelatedContent[] content) private void
addURLToDomainKeySet
(Set<String> set, URL u) protected void
analyseResponse
(RelatedContentManager.DownloadInfo to_info, RelatedContentManagerListener listener) (package private) void
checkAlternativePubs
(RelatedContentManager.DownloadInfo to_info, byte[] map_bytes, int f_cutoff) (package private) void
checkI2PSearcher
(boolean force) private RelatedContentSearcher
protected void
contentChanged
(boolean is_dirty) protected void
static String[]
convertNetworks
(byte net) static byte
convertNetworks
(String[] networks) protected RelatedContentManager.DownloadInfo
decodeInfo
(Map map, byte[] from_hash, int level, boolean explicit, Set<String> unique_keys) protected String[]
decodeTags
(byte[] bytes) protected void
(package private) void
void
delete
(RelatedContent[] content) protected void
delete
(RelatedContent[] content, RelatedContentManager.ContentCache content_cache, boolean persistent) void
(package private) void
deserialiseDI
(Map<String, Object> info_map, RelatedContentManager.ContentCache cc) protected byte[]
domainsToArray
(Set<String> domains, int max) private void
dump()
protected byte[]
encodeTags
(String[] tags) protected void
enforceMaxResults
(boolean reset_explicit) protected void
enforceMaxResults
(RelatedContentManager.ContentCache content_cache, boolean reset_explicit) protected boolean
enoughSpaceFor
(RelatedContentManager.ContentCache content_cache, RelatedContentManager.DownloadInfo fi) protected Download
getDownload
(byte[] hash) getExplicitTags
(Download download) boolean
private byte[][]
int
int
private byte
getNetworks
(Download download) int
protected byte[]
getPermDelKey
(RelatedContent info) protected String
protected List<RelatedContentManager.DownloadInfo>
static RelatedContentManager
private String
private String[]
protected List
getURLList
(TOTorrent torrent, String key) boolean
protected boolean
globalFilter
(RelatedContent content) protected void
boolean
protected boolean
isPersistentlyDeleted
(RelatedContent content) protected List<byte[]>
protected RelatedContentManager.ContentCache
void
lookupAttributes
(byte[] from_hash, RelatedAttributeLookupListener listener) void
lookupAttributes
(byte[] from_hash, String[] networks, RelatedAttributeLookupListener listener) (package private) void
lookupAttributesSupport
(byte[] from_hash, byte networks, RelatedAttributeLookupListener listener) void
lookupContent
(byte[] hash, RelatedContentLookupListener listener) void
lookupContent
(byte[] hash, String[] networks, RelatedContentLookupListener listener) void
lookupContent
(long file_size, RelatedContentLookupListener listener) void
lookupContent
(long file_size, String[] networks, RelatedContentLookupListener listener) (package private) void
lookupContentSupport
(byte[] from_hash, int level, byte networks, boolean explicit, RelatedContentLookupListener listener) (package private) void
lookupContentSupport
(long file_size, byte networks, RelatedContentLookupListener listener) private void
lookupContentSupport0
(byte[] from_hash, byte[] key_bytes, String op_str, int level, byte networks, boolean explicit, RelatedContentLookupListener listener) protected void
popuplateSecondaryLookups
(RelatedContentManager.ContentCache content_cache) static void
preInitialise
(Core _core) (package private) void
publish()
private boolean
publish
(RelatedContentManager.DownloadInfo from_info, RelatedContentManager.DownloadInfo to_info) (package private) void
void
void
removeListener
(RelatedContentManagerListener listener) (package private) void
void
void
reset()
protected void
reset
(boolean reset_perm_dels) protected void
protected void
saveRelatedContent
(int tick_count, boolean closing) searchRCM
(Map<String, Object> search_parameters, SearchObserver observer) (package private) SearchInstance
searchRCMSupport
(Map<String, Object> search_parameters, SearchObserver observer) protected void
private DHTPluginBasicInterface
selectDHT
(byte networks, boolean for_lookup) void
protected void
void
setFilterActiveOnly
(boolean b) void
setMaxResults
(int _max) void
setMaxSearchLevel
(int _level) void
setUseBiglyDHTForPublicLookups
(boolean b) protected String
truncateTag
(String tag)
-
Field Details
-
FILE_ASSOC_MIN_SIZE
public static final long FILE_ASSOC_MIN_SIZE- See Also:
-
RCM_SEARCH_PROPERTY_TRACKER_KEYS
public static final int RCM_SEARCH_PROPERTY_TRACKER_KEYS- See Also:
-
RCM_SEARCH_PROPERTY_WEB_SEED_KEYS
public static final int RCM_SEARCH_PROPERTY_WEB_SEED_KEYS- See Also:
-
RCM_SEARCH_PROPERTY_TAGS
public static final int RCM_SEARCH_PROPERTY_TAGS- See Also:
-
RCM_SEARCH_PROPERTY_NETWORKS
public static final int RCM_SEARCH_PROPERTY_NETWORKS- See Also:
-
TRACE
private static final boolean TRACE- See Also:
-
MAX_HISTORY
private static final int MAX_HISTORY- See Also:
-
MAX_TITLE_LENGTH
private static final int MAX_TITLE_LENGTH- See Also:
-
MAX_CONCURRENT_PUBLISH
private static final int MAX_CONCURRENT_PUBLISH -
DISABLE_PUBLISHING
private static final boolean DISABLE_PUBLISHING -
prefer_i2p
private static boolean prefer_i2p -
TEMPORARY_SPACE_DELTA
private static final int TEMPORARY_SPACE_DELTA- See Also:
-
MAX_RANK
private static final int MAX_RANK- See Also:
-
CONFIG_FILE
- See Also:
-
PERSIST_DEL_FILE
- See Also:
-
CONFIG_TOTAL_UNREAD
- See Also:
-
singleton
-
core
-
TIMER_PERIOD
protected static final int TIMER_PERIOD- See Also:
-
CONFIG_SAVE_CHECK_PERIOD
private static final int CONFIG_SAVE_CHECK_PERIOD- See Also:
-
CONFIG_SAVE_PERIOD
private static final int CONFIG_SAVE_PERIOD- See Also:
-
CONFIG_SAVE_CHECK_TICKS
private static final int CONFIG_SAVE_CHECK_TICKS- See Also:
-
CONFIG_SAVE_TICKS
private static final int CONFIG_SAVE_TICKS- See Also:
-
PUBLISH_CHECK_PERIOD
private static final int PUBLISH_CHECK_PERIOD- See Also:
-
PUBLISH_CHECK_TICKS
private static final int PUBLISH_CHECK_TICKS- See Also:
-
PUBLISH_SLEEPING_CHECK_PERIOD
private static final int PUBLISH_SLEEPING_CHECK_PERIOD- See Also:
-
PUBLISH_SLEEPING_CHECK_TICKS
private static final int PUBLISH_SLEEPING_CHECK_TICKS- See Also:
-
SECONDARY_LOOKUP_PERIOD
private static final int SECONDARY_LOOKUP_PERIOD- See Also:
-
SECONDARY_LOOKUP_TICKS
private static final int SECONDARY_LOOKUP_TICKS- See Also:
-
REPUBLISH_PERIOD
private static final int REPUBLISH_PERIOD- See Also:
-
REPUBLISH_TICKS
private static final int REPUBLISH_TICKS- See Also:
-
I2P_SEARCHER_CHECK_PERIOD
private static final int I2P_SEARCHER_CHECK_PERIOD- See Also:
-
I2P_SEARCHER_CHECK_TICKS
private static final int I2P_SEARCHER_CHECK_TICKS- See Also:
-
INITIAL_PUBLISH_DELAY
private static final int INITIAL_PUBLISH_DELAY- See Also:
-
INITIAL_PUBLISH_TICKS
private static final int INITIAL_PUBLISH_TICKS- See Also:
-
CONFIG_DISCARD_MILLIS
private static final int CONFIG_DISCARD_MILLIS- See Also:
-
NET_NONE
protected static final byte NET_NONE- See Also:
-
NET_PUBLIC
protected static final byte NET_PUBLIC- See Also:
-
NET_I2P
protected static final byte NET_I2P- See Also:
-
NET_TOR
protected static final byte NET_TOR- See Also:
-
NET_PUBLIC_ARRAY
-
NET_I2P_ARRAY
-
NET_TOR_ARRAY
-
NET_PUBLIC_AND_I2P_ARRAY
-
rcm_lock
-
plugin_interface
-
ta_networks
-
ta_category
-
public_dht_plugin
-
public_dht_plugin_bigly
-
i2p_dht_plugin_map
-
tag_manager
-
global_random_id
private long global_random_id -
pub_download_infos1
-
pub_download_infos2
-
non_pub_download_infos1
-
non_pub_download_infos2
-
download_info_map
private RelatedContentManager.ByteArrayHashMapEx<RelatedContentManager.DownloadInfo> download_info_map -
download_priv_set
-
enabled
private final boolean enabled -
use_bigly_dht_for_public_lookups
private boolean use_bigly_dht_for_public_lookups -
max_search_level
private int max_search_level -
max_results
private int max_results -
global_filter_active_only
private boolean global_filter_active_only -
temporary_space
-
publishing_count
private int publishing_count -
listeners
CopyOnWriteList<RelatedContentManagerListener> listeners -
initialisation_complete_sem
AESemaphore initialisation_complete_sem -
content_cache_ref
-
content_cache
-
content_dirty
private boolean content_dirty -
last_config_access
private long last_config_access -
content_discard_ticks
private int content_discard_ticks -
total_unread
-
content_change_dispatcher
-
SECONDARY_LOOKUP_CACHE_MAX
private static final int SECONDARY_LOOKUP_CACHE_MAX- See Also:
-
secondary_lookups
LinkedList<RelatedContentManager.SecondaryLookup> secondary_lookups -
secondary_lookup_in_progress
boolean secondary_lookup_in_progress -
secondary_lookup_complete_time
long secondary_lookup_complete_time -
main_transfer_type
RelatedContentManager.RCMSearchXFer main_transfer_type -
bigly_transfer_type
RelatedContentManager.RCMSearchXFerBiglyBT bigly_transfer_type -
searchers
-
added_i2p_searcher
private boolean added_i2p_searcher -
mix_searcher
-
MAX_TRANSIENT_CACHE
private static final int MAX_TRANSIENT_CACHE- See Also:
-
transient_info_cache
-
persist
boolean persist -
last_pub_was_pub
private boolean last_pub_was_pub -
MAX_TAG_LENGTH
private static final int MAX_TAG_LENGTH- See Also:
-
MAX_TAGS_TOTAL_LENGTH
private static final int MAX_TAGS_TOTAL_LENGTH- See Also:
-
PD_BLOOM_INITIAL_SIZE
private static final int PD_BLOOM_INITIAL_SIZE- See Also:
-
PD_BLOOM_INCREMENT_SIZE
private static final int PD_BLOOM_INCREMENT_SIZE- See Also:
-
persist_del_bloom
-
-
Constructor Details
-
RelatedContentManager
- Throws:
ContentException
-
-
Method Details
-
preInitialise
-
getSingleton
- Throws:
ContentException
-
delayedInit
void delayedInit() -
checkI2PSearcher
void checkI2PSearcher(boolean force) -
checkMixSearcher
-
isEnabled
public boolean isEnabled() -
getUseBiglyDHTForPublicLookups
public boolean getUseBiglyDHTForPublicLookups() -
setUseBiglyDHTForPublicLookups
public void setUseBiglyDHTForPublicLookups(boolean b) -
getMaxSearchLevel
public int getMaxSearchLevel() -
setMaxSearchLevel
public void setMaxSearchLevel(int _level) -
getMaxResults
public int getMaxResults() -
setMaxResults
public void setMaxResults(int _max) -
getFilterActiveOnly
public boolean getFilterActiveOnly() -
setFilterActiveOnly
public void setFilterActiveOnly(boolean b) -
selectDHT
-
addDownloads
-
republish
void republish() -
publish
void publish() -
publishNext
void publishNext() -
publish
private boolean publish(RelatedContentManager.DownloadInfo from_info, RelatedContentManager.DownloadInfo to_info) throws Exception - Throws:
Exception
-
checkAlternativePubs
void checkAlternativePubs(RelatedContentManager.DownloadInfo to_info, byte[] map_bytes, int f_cutoff) -
decodeInfo
protected RelatedContentManager.DownloadInfo decodeInfo(Map map, byte[] from_hash, int level, boolean explicit, Set<String> unique_keys) -
lookupAttributes
public void lookupAttributes(byte[] from_hash, RelatedAttributeLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupAttributes
public void lookupAttributes(byte[] from_hash, String[] networks, RelatedAttributeLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupAttributesSupport
void lookupAttributesSupport(byte[] from_hash, byte networks, RelatedAttributeLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupContent
public void lookupContent(byte[] hash, RelatedContentLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupContent
public void lookupContent(byte[] hash, String[] networks, RelatedContentLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupContent
public void lookupContent(long file_size, RelatedContentLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupContent
public void lookupContent(long file_size, String[] networks, RelatedContentLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupContentSupport
void lookupContentSupport(long file_size, byte networks, RelatedContentLookupListener listener) throws ContentException - Throws:
ContentException
-
lookupContentSupport
void lookupContentSupport(byte[] from_hash, int level, byte networks, boolean explicit, RelatedContentLookupListener listener) throws ContentException - Throws:
ContentException
-
getString
-
lookupContentSupport0
private void lookupContentSupport0(byte[] from_hash, byte[] key_bytes, String op_str, int level, byte networks, boolean explicit, RelatedContentLookupListener listener) throws ContentException - Throws:
ContentException
-
popuplateSecondaryLookups
-
secondaryLookup
protected void secondaryLookup() -
contentChanged
-
contentChanged
protected void contentChanged(boolean is_dirty) -
delete
-
delete
protected void delete(RelatedContent[] content, RelatedContentManager.ContentCache content_cache, boolean persistent) -
getPrivateInfoKey
-
analyseResponse
protected void analyseResponse(RelatedContentManager.DownloadInfo to_info, RelatedContentManagerListener listener) -
enoughSpaceFor
protected boolean enoughSpaceFor(RelatedContentManager.ContentCache content_cache, RelatedContentManager.DownloadInfo fi) -
getRelatedContent
-
getRelatedContentAsList
-
reset
public void reset() -
reset
protected void reset(boolean reset_perm_dels) -
searchRCM
public SearchInstance searchRCM(Map<String, Object> search_parameters, SearchObserver observer) throws SearchException- Throws:
SearchException
-
searchRCMSupport
SearchInstance searchRCMSupport(Map<String, Object> search_parameters, SearchObserver observer) throws SearchException- Throws:
SearchException
-
setConfigDirty
protected void setConfigDirty() -
loadRelatedContent
-
saveRelatedContent
protected void saveRelatedContent(int tick_count, boolean closing) -
deleteRelatedContent
void deleteRelatedContent() -
getNumUnread
public int getNumUnread() -
setAllRead
public void setAllRead() -
deleteAll
public void deleteAll() -
incrementUnread
protected void incrementUnread() -
decrementUnread
protected void decrementUnread() -
getDownload
-
getKeys
-
domainsToArray
-
getURLList
-
addURLToDomainKeySet
-
getNetworks
-
convertNetworks
-
convertNetworks
-
getExplicitTags
-
getTags
-
encodeTags
-
truncateTag
-
decodeTags
-
getPermDelKey
-
loadPersistentlyDeleted
-
addPersistentlyDeleted
-
globalFilter
-
isPersistentlyDeleted
-
resetPersistentlyDeleted
protected void resetPersistentlyDeleted() -
reserveTemporarySpace
public void reserveTemporarySpace() -
releaseTemporarySpace
public void releaseTemporarySpace() -
enforceMaxResults
protected void enforceMaxResults(boolean reset_explicit) -
enforceMaxResults
protected void enforceMaxResults(RelatedContentManager.ContentCache content_cache, boolean reset_explicit) -
addListener
-
removeListener
-
serialiseDI
private Map<String,Object> serialiseDI(RelatedContentManager.DownloadInfo info, RelatedContentManager.ContentCache cc) -
deserialiseDI
private RelatedContentManager.DownloadInfo deserialiseDI(Map<String, Object> info_map, RelatedContentManager.ContentCache cc) -
dump
private void dump()
-