.. _bittorrent: BitTorrent client for P2P filesharing ===================================== 1. **Download** desired contents: * A `~owmeta_core.data_trans.local_file_ds.LocalFileDataSource` created and stored within the local graph store contains a `torrent_file_name `_ `~owmeta_core.datasource.Informational`. This refers to the torrent containing the location of the desired contents on the BitTorrent. A ``torrent`` is used to locate files on the File System [ `BEP 3 `_ ]. A `~owmeta_core.datasource.DataSource` defines attributes about the contents that it represents. | Module ``t`` describes the ``DataSource`` attributes:: def owm_data(ns): ns.context.add_import(ConnectomeCSVDataSource.definition_context) ns.context(ConnectomeCSVDataSource)( key = '2000_connections', csv_file_name = 'connectome.csv', torrent_file_name = 'd9da5ce947c6f1c127dfcdc2ede63320.torrent' ) | The ``DataSource`` can be created and stored on the local graph with:: $ owm save t | The ``DataSource`` identifier can be used to see contents stored in the local graph with:: $ owm source show ConnectomeCSVDataSource:2000_connections ConnectomeCSVDataSource CSV file name: 'connectome.csv' File name: 'connectome.csv' Torrent file name: 'd9da5ce947c6f1c127dfcdc2ede63320.torrent' * The `BitTorrentDataSourceDirLoader `_ class inherits from the `~owmeta_core.datasource_loader.DataSourceDirLoader` and overrides its `load ()` method. `Google Drive `_ stores the ``torrents`` uploaded by other researchers. ``load()`` fetches the ``torrent`` refered to in ``torrent_file_name`` of the ``DataSource``, performs `~owmeta_core.datasource.DataTranslator` from one form to another and then adds the ``torrent`` to the `BitTorrent Client `_ for downloading its contents. | This ``BitTorrent Client`` is `available on PyPI `_ and is included in the `owmeta_core setup `_. | To install separately:: $ pip install torrent-client For reference, use the `torrent-client repository `_ and its usage information with:: $ torrent_cli.py -h | The ``DataSourceDirLoader`` attribute - ``base_directory``, which is set in the ``BitTorrentDataSourceDirLoader`` constructor is where both the ``torrent`` and its contents are downloaded:: content = BitTorrentDataSourceDirLoader("./") * Within the `.owm `_ directory we have the `credentials.json and token.pickle `_ these are for authentication of the Google Drive. For the purpose of access control the ``client_secret`` required by ``credentials.json`` will only be shared by owmeta maintainers. | * The ``torrent`` file name is the `MD5 message digest `_ of its contents. If the hash of the downloaded contents is the same as its ``torrent`` name the data is unaltered. | Data-Integrity is to be checked after 100% download completion:: $ python3 integrity.py 'd9da5ce947c6f1c127dfcdc2ede63320.torrent' 'Merged_Nuclei_Stained_Worm.zip' 2. **Upload** your contents: - On an AWS EC2 instance is running a Nginx WSGI and a Flask Server to accept .zip content file uploads. Visit this Elastic IP address [13.235.204.78] to upload your files by browsing through your filesystem and then clicking the ``Submit Query button``. - This will create a ``torrent`` and ``seed`` your contents in parts, to other peers on the BitTorrent network. Content can then be downloaded as described above.