diff --git a/docs/features.html b/docs/features.html index d153b5f61..c5fea58fc 100644 --- a/docs/features.html +++ b/docs/features.html @@ -56,9 +56,11 @@
  • network buffers
  • piece picker
  • merkle hash tree torrents
  • +
  • customizable file storage
  • +
  • easy to use API
  • -
  • portability
  • +
  • portability
  • @@ -254,6 +256,65 @@ piece size. With merkle torrents, the piece size can be the minimum block size ( which lets peers verify every block of data received from peers, immediately. This gives a minimum turnaround time and completely removes the problem of identifying malicious peers.

    +merkle_tree.png +

    The root hash is built by hashing all the piece hashes pair-wise, until they all collapse +down to the root.

    +storage.png +
    +
    +

    customizable file storage

    +

    libtorrent's storage implementation is customizable. That means a special purpose bittorrent +client can replace the default way to store files on disk.

    +

    When implementing a bittorrent cache, it doesn't matter how the data is stored on disk, as +long as it can be retrieved and seeded. In that case a new storage class can be implemented +(inheriting from the storage_interface class) that avoids the unnecessary step of mapping +slots to files and offsets. The storage can ignore the file boundaries and just store the +entire torrent in a single file (which will end up being all the files concatenated). The main +advantage of this, other than a slight cpu performance gain, is that all file operations would +be page (and sector) aligned. This enables efficient unbuffered I/O, and can potentially +lead to more efficient read caching (using the built in disk cache rather than relying on the +operating system's disk cache).

    +

    The storage interface supports operating systems where you can ask for sparse regions +(such as Windows and Solaris). The advantage of this is that when checking files, the regions +that are known to be sparse can be skipped, which can reduce the time to check a torrent +significantly.

    +
    +
    +

    easy to use API

    +

    One of the design goals of the libtorrent API is to make common operations simple, but still +have it possible to do complicated and advanced operations. This is best illustrated by example +code to implement a simple bittorrent client:

    +
    +#include <iostream>
    +#include "libtorrent/session.hpp"
    +
    +// usage a.out [torrent-file]
    +int main(int argc, char* argv[]) try
    +{
    +        using namespace libtorrent;
    +
    +        session s;
    +        s.listen_on(std::make_pair(6881, 6889));
    +        add_torrent_params p;
    +        p.save_path = "./";
    +        p.ti = new torrent_info(argv[1]);
    +        s.add_torrent(p);
    +
    +        // wait for the user to end
    +        char a;
    +        std::cin.unsetf(std::ios_base::skipws);
    +        std::cin >> a;
    +        return 0;
    +}
    +catch (std::exception& e)
    +{
    +        std::cerr << ec.what() << std::endl;
    +        return 1;
    +}
    +
    +

    This client doesn't give the user any status information or progress about the torrent, but +it is fully functional.

    +

    libtorrent also comes with python bindings for easy access for python developers.

    diff --git a/docs/features.rst b/docs/features.rst index efe609eba..453d4ad56 100644 --- a/docs/features.rst +++ b/docs/features.rst @@ -283,6 +283,45 @@ The storage interface supports operating systems where you can ask for sparse re that are known to be sparse can be skipped, which can reduce the time to check a torrent significantly. +easy to use API +--------------- + +One of the design goals of the libtorrent API is to make common operations simple, but still +have it possible to do complicated and advanced operations. This is best illustrated by example +code to implement a simple bittorrent client:: + + #include + #include "libtorrent/session.hpp" + + // usage a.out [torrent-file] + int main(int argc, char* argv[]) try + { + using namespace libtorrent; + + session s; + s.listen_on(std::make_pair(6881, 6889)); + add_torrent_params p; + p.save_path = "./"; + p.ti = new torrent_info(argv[1]); + s.add_torrent(p); + + // wait for the user to end + char a; + std::cin.unsetf(std::ios_base::skipws); + std::cin >> a; + return 0; + } + catch (std::exception& e) + { + std::cerr << ec.what() << std::endl; + return 1; + } + +This client doesn't give the user any status information or progress about the torrent, but +it is fully functional. + +libtorrent also comes with python bindings for easy access for python developers. + portability ===========