deprecate and remove guided read cache (#904)

This commit is contained in:
Arvid Norberg 2016-07-10 19:25:26 -04:00 committed by GitHub
parent 8c03718117
commit 0a3cb77d23
4 changed files with 10 additions and 28 deletions

View File

@ -788,7 +788,6 @@ namespace libtorrent
peer_connection& operator=(peer_connection const&);
void do_update_interest();
int preferred_caching() const;
void fill_send_buffer();
void on_disk_read_complete(disk_io_job const* j, peer_request r
, time_point issue_time);

View File

@ -382,12 +382,16 @@ namespace libtorrent
// place.
volatile_read_cache,
#ifndef TORRENT_NO_DEPRECATE
// ``guided_read_cache`` enables the disk cache to adjust the size of
// a cache line generated by peers to depend on the upload rate you
// are sending to that peer. The intention is to optimize the RAM
// usage of the cache, to read ahead further for peers that you're
// sending faster to.
guided_read_cache,
#else
deprecated13,
#endif
// ``no_atime_storage`` this is a linux-only option and passes in the
// ``O_NOATIME`` to ``open()`` when opening files. This may lead to
@ -1165,6 +1169,7 @@ namespace libtorrent
// to match the expiration time for tokens.
udp_tracker_token_expiry,
#ifndef TORRENT_NO_DEPRECATE
// ``default_cache_min_age`` is the minimum number of seconds any read
// cache line is kept in the cache. This defaults to one second but
// may be greater if ``guided_read_cache`` is enabled. Having a lower
@ -1172,6 +1177,9 @@ namespace libtorrent
// to avoid swapping the same pieces in and out of the cache in case
// there is a shortage of spare cache space.
default_cache_min_age,
#else
deprecated16,
#endif
// ``num_optimistic_unchoke_slots`` is the number of optimistic
// unchoke slots to use. It defaults to 0, which means automatic.

View File

@ -5026,31 +5026,6 @@ namespace libtorrent
send_block_requests();
}
int peer_connection::preferred_caching() const
{
TORRENT_ASSERT(is_single_thread());
int line_size = 0;
if (m_settings.get_bool(settings_pack::guided_read_cache))
{
boost::shared_ptr<torrent> t = m_torrent.lock();
int upload_rate = m_statistics.upload_payload_rate();
if (upload_rate == 0) upload_rate = 1;
int num_uploads = m_ses.num_uploads();
if (num_uploads == 0) num_uploads = 1;
// assume half of the cache is write cache if we're downloading
// this torrent as well
int cache_size = m_settings.get_int(settings_pack::cache_size) / num_uploads;
if (!t->is_upload_only()) cache_size /= 2;
// cache_size is the amount of cache we have per peer. The
// cache line should not be greater than this
line_size = cache_size;
}
return line_size;
}
void peer_connection::fill_send_buffer()
{
TORRENT_ASSERT(is_single_thread());

View File

@ -172,7 +172,7 @@ namespace libtorrent
SET(allow_i2p_mixed, false, nullptr),
SET(low_prio_disk, true, nullptr),
SET(volatile_read_cache, false, nullptr),
SET(guided_read_cache, false, nullptr),
DEPRECATED_SET(guided_read_cache, false, nullptr),
SET(no_atime_storage, true, nullptr),
SET(incoming_starts_queued_torrents, false, nullptr),
SET(report_true_downloaded, false, nullptr),
@ -288,7 +288,7 @@ namespace libtorrent
SET(local_service_announce_interval, 5 * 60, nullptr),
SET(dht_announce_interval, 15 * 60, &session_impl::update_dht_announce_interval),
SET(udp_tracker_token_expiry, 60, nullptr),
SET(default_cache_min_age, 1, nullptr),
DEPRECATED_SET(default_cache_min_age, 1, nullptr),
SET(num_optimistic_unchoke_slots, 0, nullptr),
SET(default_est_reciprocation_rate, 16000, nullptr),
SET(increase_est_reciprocation_rate, 20, nullptr),