Merge pull request #563 from arvidn/no-compact-1.1
remove remaining references to storage_mode_compact
This commit is contained in:
commit
a5af3b0dc5
|
@ -129,8 +129,7 @@ enum proxy_type_t
|
||||||
enum storage_mode_t
|
enum storage_mode_t
|
||||||
{
|
{
|
||||||
storage_mode_allocate = 0,
|
storage_mode_allocate = 0,
|
||||||
storage_mode_sparse,
|
storage_mode_sparse
|
||||||
storage_mode_compact
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum state_t
|
enum state_t
|
||||||
|
@ -144,7 +143,7 @@ enum state_t
|
||||||
allocating,
|
allocating,
|
||||||
checking_resume_data
|
checking_resume_data
|
||||||
};
|
};
|
||||||
|
|
||||||
struct torrent_status
|
struct torrent_status
|
||||||
{
|
{
|
||||||
enum state_t state;
|
enum state_t state;
|
||||||
|
|
|
@ -168,9 +168,6 @@ def main():
|
||||||
parser.add_option('-s', '--save-path',
|
parser.add_option('-s', '--save-path',
|
||||||
type='string', help='the path where the downloaded file/folder should be placed.')
|
type='string', help='the path where the downloaded file/folder should be placed.')
|
||||||
|
|
||||||
parser.add_option('-a', '--allocation-mode',
|
|
||||||
type='string', help='sets mode used for allocating the downloaded files on disk. Possible options are [full | compact]')
|
|
||||||
|
|
||||||
parser.add_option('-r', '--proxy-host',
|
parser.add_option('-r', '--proxy-host',
|
||||||
type='string', help='sets HTTP proxy host and port (separated by \':\')')
|
type='string', help='sets HTTP proxy host and port (separated by \':\')')
|
||||||
|
|
||||||
|
@ -179,7 +176,6 @@ def main():
|
||||||
, max_download_rate=0
|
, max_download_rate=0
|
||||||
, max_upload_rate=0
|
, max_upload_rate=0
|
||||||
, save_path='.'
|
, save_path='.'
|
||||||
, allocation_mode='compact'
|
|
||||||
, proxy_host=''
|
, proxy_host=''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -196,8 +192,6 @@ def main():
|
||||||
if options.max_download_rate <= 0:
|
if options.max_download_rate <= 0:
|
||||||
options.max_download_rate = -1
|
options.max_download_rate = -1
|
||||||
|
|
||||||
compact_allocation = options.allocation_mode == 'compact'
|
|
||||||
|
|
||||||
settings = lt.session_settings()
|
settings = lt.session_settings()
|
||||||
settings.user_agent = 'python_client/' + lt.version
|
settings.user_agent = 'python_client/' + lt.version
|
||||||
|
|
||||||
|
|
|
@ -663,9 +663,6 @@ void bind_session()
|
||||||
enum_<storage_mode_t>("storage_mode_t")
|
enum_<storage_mode_t>("storage_mode_t")
|
||||||
.value("storage_mode_allocate", storage_mode_allocate)
|
.value("storage_mode_allocate", storage_mode_allocate)
|
||||||
.value("storage_mode_sparse", storage_mode_sparse)
|
.value("storage_mode_sparse", storage_mode_sparse)
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
.value("storage_mode_compact", storage_mode_compact)
|
|
||||||
#endif
|
|
||||||
;
|
;
|
||||||
|
|
||||||
enum_<lt::session::options_t>("options_t")
|
enum_<lt::session::options_t>("options_t")
|
||||||
|
|
|
@ -522,7 +522,7 @@ The file format is a bencoded dictionary containing the following fields:
|
||||||
| | re-check is issued. |
|
| | re-check is issued. |
|
||||||
+--------------------------+--------------------------------------------------------------+
|
+--------------------------+--------------------------------------------------------------+
|
||||||
| ``allocation`` | The allocation mode for the storage. Can be either ``full`` |
|
| ``allocation`` | The allocation mode for the storage. Can be either ``full`` |
|
||||||
| | or ``compact``. If this is full, the file sizes and |
|
| | or ``sparse``. If this is full, the file sizes and |
|
||||||
| | timestamps are disregarded. Pieces are assumed not to have |
|
| | timestamps are disregarded. Pieces are assumed not to have |
|
||||||
| | moved around even if the files have been modified after the |
|
| | moved around even if the files have been modified after the |
|
||||||
| | last resume data checkpoint. |
|
| | last resume data checkpoint. |
|
||||||
|
@ -541,16 +541,6 @@ There are two modes in which storage (files on disk) are allocated in libtorrent
|
||||||
2. The *sparse allocation*, sparse files are used, and pieces are downloaded
|
2. The *sparse allocation*, sparse files are used, and pieces are downloaded
|
||||||
directly to where they belong. This is the recommended (and default) mode.
|
directly to where they belong. This is the recommended (and default) mode.
|
||||||
|
|
||||||
In previous versions of libtorrent, a 3rd mode was supported, *compact
|
|
||||||
allocation*. Support for this is deprecated and will be removed in future
|
|
||||||
versions of libtorrent. It's still described in here for completeness.
|
|
||||||
|
|
||||||
The allocation mode is selected when a torrent is started. It is passed as an
|
|
||||||
argument to session::add_torrent() or session::async_add_torrent().
|
|
||||||
|
|
||||||
The decision to use full allocation or compact allocation typically depends on
|
|
||||||
whether any files have priority 0 and if the filesystem supports sparse files.
|
|
||||||
|
|
||||||
sparse allocation
|
sparse allocation
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ namespace libtorrent
|
||||||
// The 'blocks per piece' entry is invalid in the resume data file
|
// The 'blocks per piece' entry is invalid in the resume data file
|
||||||
invalid_blocks_per_piece,
|
invalid_blocks_per_piece,
|
||||||
// The resume file is missing the 'slots' entry, which is required
|
// The resume file is missing the 'slots' entry, which is required
|
||||||
// for torrents with compact allocation
|
// for torrents with compact allocation. *DEPRECATED*
|
||||||
missing_slots,
|
missing_slots,
|
||||||
// The resume file contains more slots than the torrent
|
// The resume file contains more slots than the torrent
|
||||||
too_many_slots,
|
too_many_slots,
|
||||||
|
@ -376,7 +376,7 @@ namespace libtorrent
|
||||||
// The pieces on disk needs to be re-ordered for the specified
|
// The pieces on disk needs to be re-ordered for the specified
|
||||||
// allocation mode. This happens if you specify sparse allocation
|
// allocation mode. This happens if you specify sparse allocation
|
||||||
// and the files on disk are using compact storage. The pieces needs
|
// and the files on disk are using compact storage. The pieces needs
|
||||||
// to be moved to their right position
|
// to be moved to their right position. *DEPRECATED*
|
||||||
pieces_need_reorder,
|
pieces_need_reorder,
|
||||||
// this error is returned when asking to save resume data and
|
// this error is returned when asking to save resume data and
|
||||||
// specifying the flag to only save when there's anything new to save
|
// specifying the flag to only save when there's anything new to save
|
||||||
|
|
|
@ -153,17 +153,6 @@ namespace libtorrent
|
||||||
namespace aux { struct session_settings; }
|
namespace aux { struct session_settings; }
|
||||||
struct cached_piece_entry;
|
struct cached_piece_entry;
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT std::vector<std::pair<boost::int64_t, std::time_t> > get_filesizes(
|
|
||||||
file_storage const& t
|
|
||||||
, std::string const& p);
|
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT bool match_filesizes(
|
|
||||||
file_storage const& t
|
|
||||||
, std::string const& p
|
|
||||||
, std::vector<std::pair<boost::int64_t, std::time_t> > const& sizes
|
|
||||||
, bool compact_mode
|
|
||||||
, std::string* error = 0);
|
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT int copy_bufs(file::iovec_t const* bufs, int bytes, file::iovec_t* target);
|
TORRENT_EXTRA_EXPORT int copy_bufs(file::iovec_t const* bufs, int bytes, file::iovec_t* target);
|
||||||
TORRENT_EXTRA_EXPORT void advance_bufs(file::iovec_t*& bufs, int bytes);
|
TORRENT_EXTRA_EXPORT void advance_bufs(file::iovec_t*& bufs, int bytes);
|
||||||
TORRENT_EXTRA_EXPORT void clear_bufs(file::iovec_t const* bufs, int num_bufs);
|
TORRENT_EXTRA_EXPORT void clear_bufs(file::iovec_t const* bufs, int num_bufs);
|
||||||
|
|
|
@ -55,14 +55,7 @@ namespace libtorrent
|
||||||
|
|
||||||
// All pieces will be written to the place where they belong and sparse files
|
// All pieces will be written to the place where they belong and sparse files
|
||||||
// will be used. This is the recommended, and default mode.
|
// will be used. This is the recommended, and default mode.
|
||||||
storage_mode_sparse,
|
storage_mode_sparse
|
||||||
|
|
||||||
// internal
|
|
||||||
internal_storage_mode_compact_deprecated
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
, // comma here to avoid compiler warning
|
|
||||||
storage_mode_compact = internal_storage_mode_compact_deprecated
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// see default_storage::default_storage()
|
// see default_storage::default_storage()
|
||||||
|
@ -78,7 +71,7 @@ namespace libtorrent
|
||||||
std::vector<boost::uint8_t> const* priorities; // optional
|
std::vector<boost::uint8_t> const* priorities; // optional
|
||||||
torrent_info const* info; // optional
|
torrent_info const* info; // optional
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::function<storage_interface*(storage_params const& params)> storage_constructor_type;
|
typedef boost::function<storage_interface*(storage_params const& params)> storage_constructor_type;
|
||||||
|
|
||||||
// the constructor function for the regular file storage. This is the
|
// the constructor function for the regular file storage. This is the
|
||||||
|
|
|
@ -478,10 +478,6 @@ void test_check_files(std::string const& test_path
|
||||||
io.set_num_threads(0);
|
io.set_num_threads(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_NO_DEPRECATE
|
|
||||||
#define storage_mode_compact storage_mode_sparse
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO: 2 split this test up into smaller parts
|
// TODO: 2 split this test up into smaller parts
|
||||||
void run_test(bool unbuffered)
|
void run_test(bool unbuffered)
|
||||||
{
|
{
|
||||||
|
@ -531,7 +527,7 @@ void run_test(bool unbuffered)
|
||||||
std::cerr << "=== test 1 === " << (unbuffered?"unbuffered":"buffered") << std::endl;
|
std::cerr << "=== test 1 === " << (unbuffered?"unbuffered":"buffered") << std::endl;
|
||||||
|
|
||||||
// run_storage_tests writes piece 0, 1 and 2. not 3
|
// run_storage_tests writes piece 0, 1 and 2. not 3
|
||||||
run_storage_tests(info, fs, test_path, storage_mode_compact, unbuffered);
|
run_storage_tests(info, fs, test_path, storage_mode_sparse, unbuffered);
|
||||||
|
|
||||||
// make sure the files have the correct size
|
// make sure the files have the correct size
|
||||||
std::string base = combine_path(test_path, "temp_storage");
|
std::string base = combine_path(test_path, "temp_storage");
|
||||||
|
@ -575,7 +571,7 @@ void run_test(bool unbuffered)
|
||||||
|
|
||||||
std::cerr << "=== test 3 ===" << std::endl;
|
std::cerr << "=== test 3 ===" << std::endl;
|
||||||
|
|
||||||
run_storage_tests(info, fs, test_path, storage_mode_compact, unbuffered);
|
run_storage_tests(info, fs, test_path, storage_mode_sparse, unbuffered);
|
||||||
|
|
||||||
TEST_EQUAL(file_size(combine_path(test_path, combine_path("temp_storage", "test1.tmp"))), piece_size * 3);
|
TEST_EQUAL(file_size(combine_path(test_path, combine_path("temp_storage", "test1.tmp"))), piece_size * 3);
|
||||||
remove_all(combine_path(test_path, "temp_storage"), ec);
|
remove_all(combine_path(test_path, "temp_storage"), ec);
|
||||||
|
@ -608,7 +604,7 @@ void run_test(bool unbuffered)
|
||||||
|
|
||||||
std::cerr << "=== test 6 ===" << std::endl;
|
std::cerr << "=== test 6 ===" << std::endl;
|
||||||
test_check_files(test_path, storage_mode_sparse, unbuffered);
|
test_check_files(test_path, storage_mode_sparse, unbuffered);
|
||||||
test_check_files(test_path, storage_mode_compact, unbuffered);
|
test_check_files(test_path, storage_mode_sparse, unbuffered);
|
||||||
|
|
||||||
std::cerr << "=== test 7 ===" << std::endl;
|
std::cerr << "=== test 7 ===" << std::endl;
|
||||||
test_rename(test_path);
|
test_rename(test_path);
|
||||||
|
@ -653,7 +649,7 @@ TORRENT_TEST(fastresume)
|
||||||
add_torrent_params p;
|
add_torrent_params p;
|
||||||
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
||||||
p.save_path = combine_path(test_path, "tmp1");
|
p.save_path = combine_path(test_path, "tmp1");
|
||||||
p.storage_mode = storage_mode_compact;
|
p.storage_mode = storage_mode_sparse;
|
||||||
torrent_handle h = ses.add_torrent(p, ec);
|
torrent_handle h = ses.add_torrent(p, ec);
|
||||||
TEST_CHECK(exists(combine_path(p.save_path, "temporary")));
|
TEST_CHECK(exists(combine_path(p.save_path, "temporary")));
|
||||||
if (!exists(combine_path(p.save_path, "temporary")))
|
if (!exists(combine_path(p.save_path, "temporary")))
|
||||||
|
@ -714,7 +710,7 @@ TORRENT_TEST(fastresume)
|
||||||
p.flags &= ~add_torrent_params::flag_auto_managed;
|
p.flags &= ~add_torrent_params::flag_auto_managed;
|
||||||
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
||||||
p.save_path = combine_path(test_path, "tmp1");
|
p.save_path = combine_path(test_path, "tmp1");
|
||||||
p.storage_mode = storage_mode_compact;
|
p.storage_mode = storage_mode_sparse;
|
||||||
bencode(std::back_inserter(p.resume_data), resume);
|
bencode(std::back_inserter(p.resume_data), resume);
|
||||||
torrent_handle h = ses.add_torrent(p, ec);
|
torrent_handle h = ses.add_torrent(p, ec);
|
||||||
|
|
||||||
|
@ -769,7 +765,7 @@ TORRENT_TEST(rename_file_fastresume)
|
||||||
add_torrent_params p;
|
add_torrent_params p;
|
||||||
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
||||||
p.save_path = combine_path(test_path, "tmp2");
|
p.save_path = combine_path(test_path, "tmp2");
|
||||||
p.storage_mode = storage_mode_compact;
|
p.storage_mode = storage_mode_sparse;
|
||||||
torrent_handle h = ses.add_torrent(p, ec);
|
torrent_handle h = ses.add_torrent(p, ec);
|
||||||
|
|
||||||
h.rename_file(0, "testing_renamed_files");
|
h.rename_file(0, "testing_renamed_files");
|
||||||
|
@ -817,7 +813,7 @@ TORRENT_TEST(rename_file_fastresume)
|
||||||
add_torrent_params p;
|
add_torrent_params p;
|
||||||
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
p.ti = boost::make_shared<torrent_info>(boost::cref(*t));
|
||||||
p.save_path = combine_path(test_path, "tmp2");
|
p.save_path = combine_path(test_path, "tmp2");
|
||||||
p.storage_mode = storage_mode_compact;
|
p.storage_mode = storage_mode_sparse;
|
||||||
bencode(std::back_inserter(p.resume_data), resume);
|
bencode(std::back_inserter(p.resume_data), resume);
|
||||||
torrent_handle h = ses.add_torrent(p, ec);
|
torrent_handle h = ses.add_torrent(p, ec);
|
||||||
|
|
||||||
|
|
|
@ -455,14 +455,3 @@ TORRENT_TEST(allocate)
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
TORRENT_TEST(compact)
|
|
||||||
{
|
|
||||||
using namespace libtorrent;
|
|
||||||
fprintf(stderr, "compact mode\n");
|
|
||||||
test_transfer(0, settings_pack(), false, storage_mode_compact);
|
|
||||||
|
|
||||||
cleanup();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -139,9 +139,6 @@ void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_fil
|
||||||
p.flags |= add_torrent_params::flag_sequential_download;
|
p.flags |= add_torrent_params::flag_sequential_download;
|
||||||
p.ti = torrent_file;
|
p.ti = torrent_file;
|
||||||
p.save_path = save_path;
|
p.save_path = save_path;
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
p.storage_mode = storage_mode_compact;
|
|
||||||
#endif
|
|
||||||
torrent_handle th = ses.add_torrent(p, ec);
|
torrent_handle th = ses.add_torrent(p, ec);
|
||||||
printf("adding torrent, save_path = \"%s\" cwd = \"%s\" torrent = \"%s\"\n"
|
printf("adding torrent, save_path = \"%s\" cwd = \"%s\" torrent = \"%s\"\n"
|
||||||
, save_path.c_str(), current_working_directory().c_str()
|
, save_path.c_str(), current_working_directory().c_str()
|
||||||
|
|
Loading…
Reference in New Issue