From c39f7ddb96d757aa08532c32a0ca60f473cae418 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:03:21 +0200 Subject: [PATCH 01/11] Move metadata_store to the folder --- experiment/popularity_community/initial_filling.py | 2 +- src/tribler-core/tribler_core/components/gigachannel.py | 2 +- src/tribler-core/tribler_core/components/gigachannel_manager.py | 2 +- .../tribler_core/components/metadata_store/__init__.py | 0 .../metadata_store_component.py} | 0 src/tribler-core/tribler_core/components/popularity.py | 2 +- .../tribler_core/components/tests/test_tribler_components.py | 2 +- src/tribler-core/tribler_core/components/torrent_checker.py | 2 +- src/tribler-core/tribler_core/start_core.py | 2 +- 9 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/__init__.py rename src/tribler-core/tribler_core/components/{metadata_store.py => metadata_store/metadata_store_component.py} (100%) diff --git a/experiment/popularity_community/initial_filling.py b/experiment/popularity_community/initial_filling.py index 2615d1dea1a..e38ca6e6ba3 100644 --- a/experiment/popularity_community/initial_filling.py +++ b/experiment/popularity_community/initial_filling.py @@ -15,7 +15,7 @@ from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent -from tribler_core.components.metadata_store import MetadataStoreComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.popularity import PopularityComponent from tribler_core.components.restapi import RESTComponent from tribler_core.components.socks_configurator import SocksServersComponent diff --git a/src/tribler-core/tribler_core/components/gigachannel.py b/src/tribler-core/tribler_core/components/gigachannel.py index d52670e2b5f..2765844d48c 100644 --- a/src/tribler-core/tribler_core/components/gigachannel.py +++ b/src/tribler-core/tribler_core/components/gigachannel.py @@ -2,7 +2,7 @@ from ipv8_service import IPv8 from tribler_core.components.base import Component from tribler_core.components.ipv8 import Ipv8Component -from tribler_core.components.metadata_store import MetadataStoreComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent from tribler_core.modules.metadata_store.community.gigachannel_community import ( diff --git a/src/tribler-core/tribler_core/components/gigachannel_manager.py b/src/tribler-core/tribler_core/components/gigachannel_manager.py index 277896a0204..75d6c51b824 100644 --- a/src/tribler-core/tribler_core/components/gigachannel_manager.py +++ b/src/tribler-core/tribler_core/components/gigachannel_manager.py @@ -1,6 +1,6 @@ from tribler_core.components.base import Component from tribler_core.components.libtorrent import LibtorrentComponent -from tribler_core.components.metadata_store import MetadataStoreComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent from tribler_core.modules.metadata_store.manager.gigachannel_manager import GigaChannelManager diff --git a/src/tribler-core/tribler_core/components/metadata_store/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/components/metadata_store.py b/src/tribler-core/tribler_core/components/metadata_store/metadata_store_component.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store.py rename to src/tribler-core/tribler_core/components/metadata_store/metadata_store_component.py diff --git a/src/tribler-core/tribler_core/components/popularity.py b/src/tribler-core/tribler_core/components/popularity.py index e34079514ba..ff6924f9a36 100644 --- a/src/tribler-core/tribler_core/components/popularity.py +++ b/src/tribler-core/tribler_core/components/popularity.py @@ -2,7 +2,7 @@ from ipv8_service import IPv8 from tribler_core.components.base import Component from tribler_core.components.ipv8 import Ipv8Component -from tribler_core.components.metadata_store import MetadataStoreComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.torrent_checker import TorrentCheckerComponent from tribler_core.modules.metadata_store.community.sync_strategy import RemovePeers diff --git a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py index 70952d503af..1b66b41a04b 100644 --- a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py +++ b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py @@ -9,7 +9,7 @@ from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent -from tribler_core.components.metadata_store import MetadataStoreComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.payout import PayoutComponent from tribler_core.components.popularity import PopularityComponent from tribler_core.components.reporter import ReporterComponent diff --git a/src/tribler-core/tribler_core/components/torrent_checker.py b/src/tribler-core/tribler_core/components/torrent_checker.py index 5b2b9c4cb87..9dcf88c98c2 100644 --- a/src/tribler-core/tribler_core/components/torrent_checker.py +++ b/src/tribler-core/tribler_core/components/torrent_checker.py @@ -1,7 +1,7 @@ from tribler_common.simpledefs import STATE_START_TORRENT_CHECKER from tribler_core.components.base import Component from tribler_core.components.libtorrent import LibtorrentComponent -from tribler_core.components.metadata_store import MetadataStoreComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent from tribler_core.components.socks_configurator import SocksServersComponent diff --git a/src/tribler-core/tribler_core/start_core.py b/src/tribler-core/tribler_core/start_core.py index 57afaaddaba..0d12a1f9779 100644 --- a/src/tribler-core/tribler_core/start_core.py +++ b/src/tribler-core/tribler_core/start_core.py @@ -20,7 +20,7 @@ from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent -from tribler_core.components.metadata_store import MetadataStoreComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.payout import PayoutComponent from tribler_core.components.popularity import PopularityComponent from tribler_core.components.reporter import ReporterComponent From 14b1e4abab302566e5f1f81e2df87140ded436fe Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:04:41 +0200 Subject: [PATCH 02/11] Move category filter --- .../metadata_store}/category_filter/__init__.py | 0 .../metadata_store}/category_filter/category.conf | 0 .../metadata_store}/category_filter/category.py | 4 ++-- .../metadata_store}/category_filter/family_filter.py | 0 .../metadata_store}/category_filter/filter_terms.filter | 0 .../metadata_store}/category_filter/init_category.py | 0 .../metadata_store}/category_filter/l2_filter.py | 0 .../metadata_store}/category_filter/level2.regex | 0 .../metadata_store/category_filter/tests/__init__.py | 0 .../metadata_store}/category_filter/tests/test_category.py | 4 ++-- .../category_filter/tests/test_family_filter.py | 4 ++-- .../category_filter/tests/test_init_category.py | 4 ++-- .../modules/metadata_store/orm_bindings/torrent_metadata.py | 4 ++-- .../tribler_core/modules/metadata_store/payload_checker.py | 2 +- src/tribler-core/tribler_core/upgrade/legacy_to_pony.py | 2 +- src/tribler-core/tribler_core/upgrade/upgrade.py | 2 +- 16 files changed, 13 insertions(+), 13 deletions(-) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/__init__.py (100%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/category.conf (100%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/category.py (96%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/family_filter.py (100%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/filter_terms.filter (100%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/init_category.py (100%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/l2_filter.py (100%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/level2.regex (100%) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/__init__.py rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/tests/test_category.py (87%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/tests/test_family_filter.py (84%) rename src/tribler-core/tribler_core/{modules => components/metadata_store}/category_filter/tests/test_init_category.py (64%) diff --git a/src/tribler-core/tribler_core/modules/category_filter/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/__init__.py similarity index 100% rename from src/tribler-core/tribler_core/modules/category_filter/__init__.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/__init__.py diff --git a/src/tribler-core/tribler_core/modules/category_filter/category.conf b/src/tribler-core/tribler_core/components/metadata_store/category_filter/category.conf similarity index 100% rename from src/tribler-core/tribler_core/modules/category_filter/category.conf rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/category.conf diff --git a/src/tribler-core/tribler_core/modules/category_filter/category.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/category.py similarity index 96% rename from src/tribler-core/tribler_core/modules/category_filter/category.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/category.py index 8542f2efed1..c3ddb7e5da9 100644 --- a/src/tribler-core/tribler_core/modules/category_filter/category.py +++ b/src/tribler-core/tribler_core/components/metadata_store/category_filter/category.py @@ -7,8 +7,8 @@ import re from functools import cmp_to_key -from tribler_core.modules.category_filter.family_filter import default_xxx_filter -from tribler_core.modules.category_filter.init_category import getCategoryInfo +from tribler_core.components.metadata_store.category_filter.family_filter import default_xxx_filter +from tribler_core.components.metadata_store.category_filter.init_category import getCategoryInfo from tribler_core.utilities.install_dir import get_lib_path from tribler_core.utilities.unicode import recursive_unicode diff --git a/src/tribler-core/tribler_core/modules/category_filter/family_filter.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/family_filter.py similarity index 100% rename from src/tribler-core/tribler_core/modules/category_filter/family_filter.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/family_filter.py diff --git a/src/tribler-core/tribler_core/modules/category_filter/filter_terms.filter b/src/tribler-core/tribler_core/components/metadata_store/category_filter/filter_terms.filter similarity index 100% rename from src/tribler-core/tribler_core/modules/category_filter/filter_terms.filter rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/filter_terms.filter diff --git a/src/tribler-core/tribler_core/modules/category_filter/init_category.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/init_category.py similarity index 100% rename from src/tribler-core/tribler_core/modules/category_filter/init_category.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/init_category.py diff --git a/src/tribler-core/tribler_core/modules/category_filter/l2_filter.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/l2_filter.py similarity index 100% rename from src/tribler-core/tribler_core/modules/category_filter/l2_filter.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/l2_filter.py diff --git a/src/tribler-core/tribler_core/modules/category_filter/level2.regex b/src/tribler-core/tribler_core/components/metadata_store/category_filter/level2.regex similarity index 100% rename from src/tribler-core/tribler_core/modules/category_filter/level2.regex rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/level2.regex diff --git a/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/category_filter/tests/test_category.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_category.py similarity index 87% rename from src/tribler-core/tribler_core/modules/category_filter/tests/test_category.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_category.py index c1377294362..4b807d21e82 100644 --- a/src/tribler-core/tribler_core/modules/category_filter/tests/test_category.py +++ b/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_category.py @@ -1,5 +1,5 @@ -from tribler_core.modules.category_filter.category import cmp_rank, default_category_filter -from tribler_core.modules.category_filter.family_filter import default_xxx_filter +from tribler_core.components.metadata_store.category_filter.category import cmp_rank, default_category_filter +from tribler_core.components.metadata_store.category_filter.family_filter import default_xxx_filter default_xxx_filter.xxx_terms.add("term1") diff --git a/src/tribler-core/tribler_core/modules/category_filter/tests/test_family_filter.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_family_filter.py similarity index 84% rename from src/tribler-core/tribler_core/modules/category_filter/tests/test_family_filter.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_family_filter.py index 9e73a0340f7..f73a2df66d3 100644 --- a/src/tribler-core/tribler_core/modules/category_filter/tests/test_family_filter.py +++ b/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_family_filter.py @@ -1,7 +1,7 @@ import pytest -from tribler_core.modules.category_filter.family_filter import XXXFilter -from tribler_core.modules.category_filter.l2_filter import is_forbidden +from tribler_core.components.metadata_store.category_filter.family_filter import XXXFilter +from tribler_core.components.metadata_store.category_filter.l2_filter import is_forbidden @pytest.fixture diff --git a/src/tribler-core/tribler_core/modules/category_filter/tests/test_init_category.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_init_category.py similarity index 64% rename from src/tribler-core/tribler_core/modules/category_filter/tests/test_init_category.py rename to src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_init_category.py index ac9870daa03..30287090c63 100644 --- a/src/tribler-core/tribler_core/modules/category_filter/tests/test_init_category.py +++ b/src/tribler-core/tribler_core/components/metadata_store/category_filter/tests/test_init_category.py @@ -1,5 +1,5 @@ -from tribler_core.modules.category_filter.category import CATEGORY_CONFIG_FILE -from tribler_core.modules.category_filter.init_category import INIT_FUNC_DICT, getCategoryInfo +from tribler_core.components.metadata_store.category_filter.category import CATEGORY_CONFIG_FILE +from tribler_core.components.metadata_store.category_filter.init_category import INIT_FUNC_DICT, getCategoryInfo def test_split_list(): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_metadata.py b/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_metadata.py index c25e0ad3ff8..f2697a61b2b 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_metadata.py +++ b/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_metadata.py @@ -4,8 +4,8 @@ from pony import orm from pony.orm import db_session -from tribler_core.modules.category_filter.category import default_category_filter -from tribler_core.modules.category_filter.family_filter import default_xxx_filter +from tribler_core.components.metadata_store.category_filter.category import default_category_filter +from tribler_core.components.metadata_store.category_filter.family_filter import default_xxx_filter from tribler_core.modules.metadata_store.orm_bindings.channel_node import COMMITTED from tribler_core.modules.metadata_store.serialization import EPOCH, REGULAR_TORRENT, TorrentMetadataPayload from tribler_core.utilities.tracker_utils import get_uniformed_tracker_url diff --git a/src/tribler-core/tribler_core/modules/metadata_store/payload_checker.py b/src/tribler-core/tribler_core/modules/metadata_store/payload_checker.py index 75dd51bca0b..2a280c189e4 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/payload_checker.py +++ b/src/tribler-core/tribler_core/modules/metadata_store/payload_checker.py @@ -3,7 +3,7 @@ from pony.orm import db_session -from tribler_core.modules.category_filter.l2_filter import is_forbidden +from tribler_core.components.metadata_store.category_filter.l2_filter import is_forbidden from tribler_core.modules.metadata_store.serialization import ( CHANNEL_DESCRIPTION, CHANNEL_THUMBNAIL, diff --git a/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py b/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py index a2d4e72ec68..5e03930b58a 100644 --- a/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py +++ b/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py @@ -9,7 +9,7 @@ from pony import orm from pony.orm import db_session -from tribler_core.modules.category_filter.l2_filter import is_forbidden +from tribler_core.components.metadata_store.category_filter.l2_filter import is_forbidden from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import BLOB_EXTENSION from tribler_core.modules.metadata_store.orm_bindings.channel_node import LEGACY_ENTRY, NEW from tribler_core.modules.metadata_store.orm_bindings.torrent_metadata import infohash_to_id diff --git a/src/tribler-core/tribler_core/upgrade/upgrade.py b/src/tribler-core/tribler_core/upgrade/upgrade.py index eec02a7cbe2..640a1dd0297 100644 --- a/src/tribler-core/tribler_core/upgrade/upgrade.py +++ b/src/tribler-core/tribler_core/upgrade/upgrade.py @@ -8,7 +8,7 @@ from tribler_common.simpledefs import NTFY, STATEDIR_DB_DIR, STATEDIR_CHANNELS_DIR from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase -from tribler_core.modules.category_filter.l2_filter import is_forbidden +from tribler_core.components.metadata_store.category_filter.l2_filter import is_forbidden from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT from tribler_core.modules.metadata_store.store import ( From 13ef0be1264983091a9769d28b1ff67fd6a0aa34 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:12:50 +0200 Subject: [PATCH 03/11] Merge mds --- experiment/popularity_community/crawl_torrents.py | 2 +- experiment/popularity_community/initial_filling.py | 2 +- src/seedbox/disseminator.py | 4 ++-- .../tribler_core/components/gigachannel.py | 4 ++-- .../tribler_core/components/gigachannel_manager.py | 2 +- .../metadata_store/community/__init__.py | 0 .../metadata_store/community/discovery_booster.py | 0 .../community/gigachannel_community.py | 8 ++++---- .../metadata_store/community/payload.py | 0 .../metadata_store/community}/payload_checker.py | 2 +- .../metadata_store/community/request.py | 0 .../metadata_store/community}/settings.py | 0 .../metadata_store/community/sync_strategy.py | 0 .../metadata_store/community/tests}/__init__.py | 0 .../community/tests/test_discovery_booster.py | 2 +- .../community/tests/test_gigachannel_community.py | 8 ++++---- .../community/tests/test_sync_strategy.py | 2 +- .../{modules => components}/metadata_store/config.py | 0 .../components/metadata_store/db/__init__.py | 0 .../metadata_store/db}/orm_bindings/__init__.py | 0 .../metadata_store/db}/orm_bindings/binary_node.py | 2 +- .../db}/orm_bindings/channel_description.py | 2 +- .../db}/orm_bindings/channel_metadata.py | 6 +++--- .../metadata_store/db}/orm_bindings/channel_node.py | 4 ++-- .../metadata_store/db}/orm_bindings/channel_peer.py | 0 .../db}/orm_bindings/channel_thumbnail.py | 2 +- .../metadata_store/db}/orm_bindings/channel_vote.py | 0 .../db}/orm_bindings/collection_node.py | 10 +++++----- .../db/orm_bindings}/discrete_clock.py | 2 +- .../metadata_store/db}/orm_bindings/json_node.py | 2 +- .../metadata_store/db}/orm_bindings/metadata_node.py | 2 +- .../metadata_store/db}/orm_bindings/misc.py | 0 .../db}/orm_bindings/torrent_metadata.py | 4 ++-- .../metadata_store/db}/orm_bindings/torrent_state.py | 0 .../metadata_store/db}/orm_bindings/tracker_state.py | 0 .../metadata_store/db}/orm_bindings/vsids.py | 2 +- .../metadata_store/db}/serialization.py | 0 .../metadata_store/db}/store.py | 12 ++++++------ .../components/metadata_store/manager/__init__.py | 0 .../metadata_store/manager/gigachannel_manager.py | 6 +++--- .../metadata_store/metadata_store_component.py | 4 ++-- .../components/metadata_store/restapi/__init__.py | 0 .../metadata_store/restapi/channels_endpoint.py | 10 +++++----- .../metadata_store/restapi/metadata_endpoint.py | 4 ++-- .../metadata_store/restapi/metadata_endpoint_base.py | 2 +- .../metadata_store/restapi/metadata_schema.py | 0 .../metadata_store/restapi/remote_query_endpoint.py | 4 ++-- .../metadata_store/restapi/search_endpoint.py | 6 +++--- .../metadata_store/restapi/tests/__init__.py | 0 .../metadata_store/restapi/tests/conftest.py | 2 +- .../restapi/tests/test_channels_endpoint.py | 8 ++++---- .../restapi/tests/test_metadata_endpoint.py | 4 ++-- .../restapi/tests/test_remote_query_endpoint.py | 4 ++-- .../restapi/tests/test_search_endpoint.py | 2 +- .../components/metadata_store/tests/__init__.py | 0 .../metadata_store/tests/gen_test_data.py | 6 +++--- .../metadata_store/tests/test_channel_download.py | 4 ++-- .../metadata_store/tests/test_channel_metadata.py | 8 ++++---- .../metadata_store/tests/test_gigachannel_manager.py | 4 ++-- .../metadata_store/tests/test_metadata.py | 2 +- .../metadata_store/tests/test_store.py | 10 +++++----- .../metadata_store/tests/test_timeutils.py | 2 +- .../metadata_store/tests/test_torrent_metadata.py | 8 ++++---- .../metadata_store/tests/test_tracker_state.py | 0 .../{modules => components}/metadata_store/utils.py | 0 .../tribler_core/components/popularity.py | 2 +- .../tribler_core/config/tribler_config_sections.py | 2 +- src/tribler-core/tribler_core/conftest.py | 2 +- .../restapi/tests/test_torrentinfo_endpoint.py | 2 +- .../libtorrent/restapi/torrentinfo_endpoint.py | 2 +- .../tribler_core/modules/metadata_store/__init__.py | 4 ---- .../popularity/tests/test_popularity_community.py | 2 +- .../modules/remote_query_community/community.py | 10 +++++----- .../tests/test_remote_query_community.py | 6 +++--- .../modules/torrent_checker/torrent_checker.py | 2 +- .../modules/torrent_checker/tracker_manager.py | 2 +- .../tribler_core/restapi/root_endpoint.py | 8 ++++---- src/tribler-core/tribler_core/upgrade/db8_to_db10.py | 2 +- .../tribler_core/upgrade/legacy_to_pony.py | 10 +++++----- .../upgrade/tests/test_legacy_to_pony.py | 4 ++-- .../tribler_core/upgrade/tests/test_upgrader.py | 4 ++-- src/tribler-core/tribler_core/upgrade/upgrade.py | 6 +++--- .../dialogs/addtopersonalchanneldialog.py | 2 +- .../tribler_gui/widgets/channelcontentswidget.py | 4 ++-- .../tribler_gui/widgets/channelsmenulistwidget.py | 2 +- src/tribler-gui/tribler_gui/widgets/lazytableview.py | 3 +-- .../tribler_gui/widgets/searchresultswidget.py | 2 +- .../tribler_gui/widgets/tablecontentdelegate.py | 3 +-- .../tribler_gui/widgets/tablecontentmodel.py | 4 ++-- .../tribler_gui/widgets/triblertablecontrollers.py | 2 +- 90 files changed, 136 insertions(+), 142 deletions(-) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/__init__.py (100%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/discovery_booster.py (100%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/gigachannel_community.py (96%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/payload.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/community}/payload_checker.py (99%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/request.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/community}/settings.py (100%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/sync_strategy.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store/manager => components/metadata_store/community/tests}/__init__.py (100%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/tests/test_discovery_booster.py (94%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/tests/test_gigachannel_community.py (97%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/community/tests/test_sync_strategy.py (95%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/config.py (100%) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/db/__init__.py rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/__init__.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/binary_node.py (88%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/channel_description.py (72%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/channel_metadata.py (99%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/channel_node.py (98%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/channel_peer.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/channel_thumbnail.py (72%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/channel_vote.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/collection_node.py (97%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db/orm_bindings}/discrete_clock.py (90%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/json_node.py (89%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/metadata_node.py (94%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/misc.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/torrent_metadata.py (97%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/torrent_state.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/tracker_state.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/orm_bindings/vsids.py (98%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/serialization.py (100%) rename src/tribler-core/tribler_core/{modules/metadata_store => components/metadata_store/db}/store.py (98%) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/manager/__init__.py rename src/tribler-core/tribler_core/{modules => components}/metadata_store/manager/gigachannel_manager.py (98%) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/restapi/__init__.py rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/channels_endpoint.py (97%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/metadata_endpoint.py (98%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/metadata_endpoint_base.py (95%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/metadata_schema.py (100%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/remote_query_endpoint.py (94%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/search_endpoint.py (94%) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/restapi/tests/__init__.py rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/tests/conftest.py (96%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/tests/test_channels_endpoint.py (98%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/tests/test_metadata_endpoint.py (97%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/tests/test_remote_query_endpoint.py (93%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/restapi/tests/test_search_endpoint.py (98%) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/tests/__init__.py rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/gen_test_data.py (91%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_channel_download.py (95%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_channel_metadata.py (99%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_gigachannel_manager.py (98%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_metadata.py (98%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_store.py (97%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_timeutils.py (89%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_torrent_metadata.py (97%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/tests/test_tracker_state.py (100%) rename src/tribler-core/tribler_core/{modules => components}/metadata_store/utils.py (100%) delete mode 100644 src/tribler-core/tribler_core/modules/metadata_store/__init__.py diff --git a/experiment/popularity_community/crawl_torrents.py b/experiment/popularity_community/crawl_torrents.py index 295c7d005be..7538bbd4a31 100644 --- a/experiment/popularity_community/crawl_torrents.py +++ b/experiment/popularity_community/crawl_torrents.py @@ -49,7 +49,7 @@ SelectRequest, \ SelectResponsePayload from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings -from tribler_core.modules.metadata_store.serialization import REGULAR_TORRENT +from tribler_core.components.metadata_store.db.serialization import REGULAR_TORRENT from tribler_core.utilities.tiny_tribler_service import TinyTriblerService from tribler_core.utilities.unicode import hexlify diff --git a/experiment/popularity_community/initial_filling.py b/experiment/popularity_community/initial_filling.py index e38ca6e6ba3..0bef4aae720 100644 --- a/experiment/popularity_community/initial_filling.py +++ b/experiment/popularity_community/initial_filling.py @@ -21,7 +21,7 @@ from tribler_core.components.socks_configurator import SocksServersComponent from tribler_core.components.torrent_checker import TorrentCheckerComponent from tribler_core.config.tribler_config import TriblerConfig -from tribler_core.modules.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers from tribler_core.modules.popularity.community import PopularityCommunity from tribler_core.utilities.tiny_tribler_service import TinyTriblerService diff --git a/src/seedbox/disseminator.py b/src/seedbox/disseminator.py index 362f1c37cb6..3c7e4a926a1 100644 --- a/src/seedbox/disseminator.py +++ b/src/seedbox/disseminator.py @@ -30,8 +30,8 @@ import sentry_sdk from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.community.gigachannel_community import GigaChannelCommunity -from tribler_core.modules.metadata_store.orm_bindings.channel_node import NEW +from tribler_core.components.metadata_store.community import GigaChannelCommunity +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW from tribler_core.utilities.tiny_tribler_service import TinyTriblerService # fmt: off diff --git a/src/tribler-core/tribler_core/components/gigachannel.py b/src/tribler-core/tribler_core/components/gigachannel.py index 2765844d48c..d94c3cb7cad 100644 --- a/src/tribler-core/tribler_core/components/gigachannel.py +++ b/src/tribler-core/tribler_core/components/gigachannel.py @@ -5,11 +5,11 @@ from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent -from tribler_core.modules.metadata_store.community.gigachannel_community import ( +from tribler_core.components.metadata_store.community import ( GigaChannelCommunity, GigaChannelTestnetCommunity, ) -from tribler_core.modules.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers from tribler_core.restapi.rest_manager import RESTManager INFINITE = -1 diff --git a/src/tribler-core/tribler_core/components/gigachannel_manager.py b/src/tribler-core/tribler_core/components/gigachannel_manager.py index 75d6c51b824..4e3b135c589 100644 --- a/src/tribler-core/tribler_core/components/gigachannel_manager.py +++ b/src/tribler-core/tribler_core/components/gigachannel_manager.py @@ -3,7 +3,7 @@ from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent -from tribler_core.modules.metadata_store.manager.gigachannel_manager import GigaChannelManager +from tribler_core.components.metadata_store.manager.gigachannel_manager import GigaChannelManager from tribler_core.restapi.rest_manager import RESTManager diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/community/__init__.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/community/__init__.py rename to src/tribler-core/tribler_core/components/metadata_store/community/__init__.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/discovery_booster.py b/src/tribler-core/tribler_core/components/metadata_store/community/discovery_booster.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/community/discovery_booster.py rename to src/tribler-core/tribler_core/components/metadata_store/community/discovery_booster.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/gigachannel_community.py b/src/tribler-core/tribler_core/components/metadata_store/community/gigachannel_community.py similarity index 96% rename from src/tribler-core/tribler_core/modules/metadata_store/community/gigachannel_community.py rename to src/tribler-core/tribler_core/components/metadata_store/community/gigachannel_community.py index 07dab7b9929..ba68ffe19f2 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/community/gigachannel_community.py +++ b/src/tribler-core/tribler_core/components/metadata_store/community/gigachannel_community.py @@ -11,10 +11,10 @@ from tribler_common.simpledefs import CHANNELS_VIEW_UUID, NTFY -from tribler_core.modules.metadata_store.community.discovery_booster import DiscoveryBooster -from tribler_core.modules.metadata_store.payload_checker import ObjState -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT -from tribler_core.modules.metadata_store.utils import NoChannelSourcesException +from tribler_core.components.metadata_store.community.discovery_booster import DiscoveryBooster +from tribler_core.components.metadata_store.community.payload_checker import ObjState +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT +from tribler_core.components.metadata_store.utils import NoChannelSourcesException from tribler_core.modules.remote_query_community.community import RemoteQueryCommunity from tribler_core.utilities.unicode import hexlify diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/payload.py b/src/tribler-core/tribler_core/components/metadata_store/community/payload.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/community/payload.py rename to src/tribler-core/tribler_core/components/metadata_store/community/payload.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/payload_checker.py b/src/tribler-core/tribler_core/components/metadata_store/community/payload_checker.py similarity index 99% rename from src/tribler-core/tribler_core/modules/metadata_store/payload_checker.py rename to src/tribler-core/tribler_core/components/metadata_store/community/payload_checker.py index 2a280c189e4..f4dab87207b 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/payload_checker.py +++ b/src/tribler-core/tribler_core/components/metadata_store/community/payload_checker.py @@ -4,7 +4,7 @@ from pony.orm import db_session from tribler_core.components.metadata_store.category_filter.l2_filter import is_forbidden -from tribler_core.modules.metadata_store.serialization import ( +from tribler_core.components.metadata_store.db.serialization import ( CHANNEL_DESCRIPTION, CHANNEL_THUMBNAIL, CHANNEL_TORRENT, diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/request.py b/src/tribler-core/tribler_core/components/metadata_store/community/request.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/community/request.py rename to src/tribler-core/tribler_core/components/metadata_store/community/request.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/settings.py b/src/tribler-core/tribler_core/components/metadata_store/community/settings.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/settings.py rename to src/tribler-core/tribler_core/components/metadata_store/community/settings.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/sync_strategy.py b/src/tribler-core/tribler_core/components/metadata_store/community/sync_strategy.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/community/sync_strategy.py rename to src/tribler-core/tribler_core/components/metadata_store/community/sync_strategy.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/manager/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/community/tests/__init__.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/manager/__init__.py rename to src/tribler-core/tribler_core/components/metadata_store/community/tests/__init__.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_discovery_booster.py b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_discovery_booster.py similarity index 94% rename from src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_discovery_booster.py rename to src/tribler-core/tribler_core/components/metadata_store/community/tests/test_discovery_booster.py index 6cc79a1742c..1b36f99bdff 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_discovery_booster.py +++ b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_discovery_booster.py @@ -1,6 +1,6 @@ import pytest -from tribler_core.modules.metadata_store.community.discovery_booster import DiscoveryBooster +from tribler_core.components.metadata_store.community.discovery_booster import DiscoveryBooster TEST_BOOSTER_TIMEOUT_IN_SEC = 10 TEST_BOOSTER_TAKE_STEP_INTERVAL_IN_SEC = 1 diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_gigachannel_community.py b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py similarity index 97% rename from src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_gigachannel_community.py rename to src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py index 016a9db785d..b6df2041b6a 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_gigachannel_community.py +++ b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py @@ -11,14 +11,14 @@ import pytest -from tribler_core.modules.metadata_store.community.gigachannel_community import ( +from tribler_core.components.metadata_store.community.gigachannel_community import ( ChannelsPeersMapping, GigaChannelCommunity, NoChannelSourcesException, ) -from tribler_core.modules.metadata_store.settings import ChantSettings -from tribler_core.modules.metadata_store.store import MetadataStore -from tribler_core.modules.metadata_store.utils import RequestTimeoutException +from tribler_core.components.metadata_store.community.settings import ChantSettings +from tribler_core.components.metadata_store.db.store import MetadataStore +from tribler_core.components.metadata_store.utils import RequestTimeoutException from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings from tribler_core.notifier import Notifier from tribler_core.utilities.path_util import Path diff --git a/src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_sync_strategy.py b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_sync_strategy.py similarity index 95% rename from src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_sync_strategy.py rename to src/tribler-core/tribler_core/components/metadata_store/community/tests/test_sync_strategy.py index 974e3ee7dc0..b8b0a32baa7 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/community/tests/test_sync_strategy.py +++ b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_sync_strategy.py @@ -3,7 +3,7 @@ from ipv8.peerdiscovery.network import Network from ipv8.test.base import TestBase -from tribler_core.modules.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers class MockCommunity: diff --git a/src/tribler-core/tribler_core/modules/metadata_store/config.py b/src/tribler-core/tribler_core/components/metadata_store/config.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/config.py rename to src/tribler-core/tribler_core/components/metadata_store/config.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/db/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/db/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/__init__.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/__init__.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/__init__.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/binary_node.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/binary_node.py similarity index 88% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/binary_node.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/binary_node.py index e7d5d19d672..ba56337fa1d 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/binary_node.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/binary_node.py @@ -1,6 +1,6 @@ from pony.orm import Optional -from tribler_core.modules.metadata_store.serialization import BINARY_NODE, BinaryNodePayload +from tribler_core.components.metadata_store.db.serialization import BINARY_NODE, BinaryNodePayload def define_binding(db, db_version: int): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_description.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_description.py similarity index 72% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_description.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_description.py index 2eb078b309b..4a4b3012e58 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_description.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_description.py @@ -1,4 +1,4 @@ -from tribler_core.modules.metadata_store.serialization import CHANNEL_DESCRIPTION +from tribler_core.components.metadata_store.db.serialization import CHANNEL_DESCRIPTION def define_binding(db): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_metadata.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_metadata.py similarity index 99% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_metadata.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_metadata.py index 6d87f892bf5..8b7327e6df7 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_metadata.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_metadata.py @@ -9,8 +9,8 @@ from tribler_common.simpledefs import CHANNEL_STATE -from tribler_core.modules.metadata_store.discrete_clock import clock -from tribler_core.modules.metadata_store.orm_bindings.channel_node import ( +from tribler_core.components.metadata_store.db.orm_bindings.discrete_clock import clock +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import ( CHANNEL_DESCRIPTION_FLAG, CHANNEL_THUMBNAIL_FLAG, COMMITTED, @@ -20,7 +20,7 @@ TODELETE, UPDATED, ) -from tribler_core.modules.metadata_store.serialization import ( +from tribler_core.components.metadata_store.db.serialization import ( CHANNEL_TORRENT, ChannelMetadataPayload, HealthItemsPayload, diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_node.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_node.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_node.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_node.py index aaed7b6dd96..1dfffef204a 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_node.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_node.py @@ -7,8 +7,8 @@ from pony.orm.core import DEFAULT, db_session from tribler_core.exceptions import InvalidChannelNodeException, InvalidSignatureException -from tribler_core.modules.metadata_store.discrete_clock import clock -from tribler_core.modules.metadata_store.serialization import ( +from tribler_core.components.metadata_store.db.orm_bindings.discrete_clock import clock +from tribler_core.components.metadata_store.db.serialization import ( CHANNEL_NODE, ChannelNodePayload, DELETED, diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_peer.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_peer.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_peer.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_peer.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_thumbnail.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_thumbnail.py similarity index 72% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_thumbnail.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_thumbnail.py index ed0e8010c2b..68efd8df1f5 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_thumbnail.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_thumbnail.py @@ -1,4 +1,4 @@ -from tribler_core.modules.metadata_store.serialization import CHANNEL_THUMBNAIL +from tribler_core.components.metadata_store.db.serialization import CHANNEL_THUMBNAIL def define_binding(db): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_vote.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_vote.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/channel_vote.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/channel_vote.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/collection_node.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/collection_node.py similarity index 97% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/collection_node.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/collection_node.py index 801b830369c..cb6b0286def 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/collection_node.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/collection_node.py @@ -8,9 +8,9 @@ from tribler_core.exceptions import DuplicateTorrentFileError from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.discrete_clock import clock -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import chunks -from tribler_core.modules.metadata_store.orm_bindings.channel_node import ( +from tribler_core.components.metadata_store.db.orm_bindings.discrete_clock import clock +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import chunks +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import ( CHANNEL_DESCRIPTION_FLAG, CHANNEL_THUMBNAIL_FLAG, COMMITTED, @@ -19,8 +19,8 @@ TODELETE, UPDATED, ) -from tribler_core.modules.metadata_store.orm_bindings.torrent_metadata import tdef_to_metadata_dict -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, CollectionNodePayload +from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import tdef_to_metadata_dict +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, CollectionNodePayload from tribler_core.utilities.random_utils import random_infohash # pylint: disable=too-many-statements diff --git a/src/tribler-core/tribler_core/modules/metadata_store/discrete_clock.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/discrete_clock.py similarity index 90% rename from src/tribler-core/tribler_core/modules/metadata_store/discrete_clock.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/discrete_clock.py index af11dba1a3a..387c7d2a1c4 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/discrete_clock.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/discrete_clock.py @@ -6,7 +6,7 @@ # not go backwards between Tribler restarts. from datetime import datetime -from tribler_core.modules.metadata_store.serialization import time2int +from tribler_core.components.metadata_store.db.serialization import time2int class DiscreteClock: diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/json_node.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/json_node.py similarity index 89% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/json_node.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/json_node.py index 7e03f9a684b..20f2ba25b85 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/json_node.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/json_node.py @@ -1,6 +1,6 @@ from pony.orm import Optional -from tribler_core.modules.metadata_store.serialization import JSON_NODE, JsonNodePayload +from tribler_core.components.metadata_store.db.serialization import JSON_NODE, JsonNodePayload def define_binding(db, db_version: int): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/metadata_node.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/metadata_node.py similarity index 94% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/metadata_node.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/metadata_node.py index cbccbd56880..98351b28a2d 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/metadata_node.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/metadata_node.py @@ -1,6 +1,6 @@ from pony import orm -from tribler_core.modules.metadata_store.serialization import METADATA_NODE, MetadataNodePayload +from tribler_core.components.metadata_store.db.serialization import METADATA_NODE, MetadataNodePayload def define_binding(db): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/misc.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/misc.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/misc.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/misc.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_metadata.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/torrent_metadata.py similarity index 97% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_metadata.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/torrent_metadata.py index f2697a61b2b..725ed5b4943 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_metadata.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/torrent_metadata.py @@ -6,8 +6,8 @@ from tribler_core.components.metadata_store.category_filter.category import default_category_filter from tribler_core.components.metadata_store.category_filter.family_filter import default_xxx_filter -from tribler_core.modules.metadata_store.orm_bindings.channel_node import COMMITTED -from tribler_core.modules.metadata_store.serialization import EPOCH, REGULAR_TORRENT, TorrentMetadataPayload +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import COMMITTED +from tribler_core.components.metadata_store.db.serialization import EPOCH, REGULAR_TORRENT, TorrentMetadataPayload from tribler_core.utilities.tracker_utils import get_uniformed_tracker_url from tribler_core.utilities.unicode import ensure_unicode, hexlify diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_state.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/torrent_state.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/torrent_state.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/torrent_state.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/tracker_state.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/tracker_state.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/tracker_state.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/tracker_state.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/vsids.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/vsids.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/vsids.py rename to src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/vsids.py index 6412f527adb..49b256ebc69 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/orm_bindings/vsids.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/vsids.py @@ -4,7 +4,7 @@ from pony import orm from pony.orm import db_session -from tribler_core.modules.metadata_store.orm_bindings.channel_node import LEGACY_ENTRY +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import LEGACY_ENTRY def define_binding(db): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/serialization.py b/src/tribler-core/tribler_core/components/metadata_store/db/serialization.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/serialization.py rename to src/tribler-core/tribler_core/components/metadata_store/db/serialization.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/store.py b/src/tribler-core/tribler_core/components/metadata_store/db/store.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/store.py rename to src/tribler-core/tribler_core/components/metadata_store/db/store.py index 2e64a2f7b38..269fa81d2ea 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/store.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/store.py @@ -13,7 +13,7 @@ from tribler_common.simpledefs import NTFY from tribler_core.exceptions import InvalidSignatureException -from tribler_core.modules.metadata_store.orm_bindings import ( +from tribler_core.components.metadata_store.db.orm_bindings import ( binary_node, channel_description, channel_metadata, @@ -30,11 +30,11 @@ tracker_state, vsids, ) -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import get_mdblob_sequence_number -from tribler_core.modules.metadata_store.orm_bindings.channel_node import LEGACY_ENTRY, TODELETE -from tribler_core.modules.metadata_store.orm_bindings.torrent_metadata import NULL_KEY_SUBST -from tribler_core.modules.metadata_store.payload_checker import process_payload -from tribler_core.modules.metadata_store.serialization import ( +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import get_mdblob_sequence_number +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import LEGACY_ENTRY, TODELETE +from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import NULL_KEY_SUBST +from tribler_core.components.metadata_store.community.payload_checker import process_payload +from tribler_core.components.metadata_store.db.serialization import ( BINARY_NODE, CHANNEL_DESCRIPTION, CHANNEL_NODE, diff --git a/src/tribler-core/tribler_core/components/metadata_store/manager/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/manager/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/metadata_store/manager/gigachannel_manager.py b/src/tribler-core/tribler_core/components/metadata_store/manager/gigachannel_manager.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/manager/gigachannel_manager.py rename to src/tribler-core/tribler_core/components/metadata_store/manager/gigachannel_manager.py index cfa89d50298..e502889ea5a 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/manager/gigachannel_manager.py +++ b/src/tribler-core/tribler_core/components/metadata_store/manager/gigachannel_manager.py @@ -11,9 +11,9 @@ from tribler_core.modules.libtorrent.download_config import DownloadConfig from tribler_core.modules.libtorrent.download_manager import DownloadManager from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.orm_bindings.channel_node import COMMITTED -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import COMMITTED +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.notifier import Notifier from tribler_core.utilities.unicode import hexlify diff --git a/src/tribler-core/tribler_core/components/metadata_store/metadata_store_component.py b/src/tribler-core/tribler_core/components/metadata_store/metadata_store_component.py index 9f9690b067a..86e384801d0 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/metadata_store_component.py +++ b/src/tribler-core/tribler_core/components/metadata_store/metadata_store_component.py @@ -4,8 +4,8 @@ from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent from tribler_core.components.upgrade import UpgradeComponent -from tribler_core.modules.metadata_store.store import MetadataStore -from tribler_core.modules.metadata_store.utils import generate_test_channels +from tribler_core.components.metadata_store.db.store import MetadataStore +from tribler_core.components.metadata_store.utils import generate_test_channels from tribler_core.restapi.rest_manager import RESTManager diff --git a/src/tribler-core/tribler_core/components/metadata_store/restapi/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/channels_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/channels_endpoint.py similarity index 97% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/channels_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/channels_endpoint.py index 3d2cfac3bab..d8aea7bde9b 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/channels_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/channels_endpoint.py @@ -18,11 +18,11 @@ from tribler_common.simpledefs import CHANNEL_STATE from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.orm_bindings.channel_node import DIRTY_STATUSES, NEW -from tribler_core.modules.metadata_store.restapi.metadata_endpoint_base import MetadataEndpointBase -from tribler_core.modules.metadata_store.restapi.metadata_schema import ChannelSchema -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, REGULAR_TORRENT -from tribler_core.modules.metadata_store.utils import NoChannelSourcesException, RequestTimeoutException +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import DIRTY_STATUSES, NEW +from tribler_core.components.metadata_store.restapi.metadata_endpoint_base import MetadataEndpointBase +from tribler_core.components.metadata_store.restapi.metadata_schema import ChannelSchema +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, REGULAR_TORRENT +from tribler_core.components.metadata_store.utils import NoChannelSourcesException, RequestTimeoutException from tribler_core.restapi.rest_endpoint import HTTP_BAD_REQUEST, HTTP_NOT_FOUND, RESTResponse from tribler_core.restapi.schema import HandledErrorSchema from tribler_core.utilities.unicode import hexlify diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_endpoint.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_endpoint.py index d1a5edf4d30..4f4931cc38f 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_endpoint.py @@ -10,8 +10,8 @@ from pony.orm import db_session -from tribler_core.modules.metadata_store.orm_bindings.channel_node import LEGACY_ENTRY -from tribler_core.modules.metadata_store.restapi.metadata_endpoint_base import MetadataEndpointBase +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import LEGACY_ENTRY +from tribler_core.components.metadata_store.restapi.metadata_endpoint_base import MetadataEndpointBase from tribler_core.restapi.rest_endpoint import HTTP_BAD_REQUEST, HTTP_NOT_FOUND, RESTResponse from tribler_core.restapi.schema import HandledErrorSchema from tribler_core.utilities.unicode import hexlify diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_endpoint_base.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_endpoint_base.py similarity index 95% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_endpoint_base.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_endpoint_base.py index 0517b105512..b30900f5327 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_endpoint_base.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_endpoint_base.py @@ -1,4 +1,4 @@ -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_core.restapi.rest_endpoint import RESTEndpoint # This dict is used to translate JSON fields into the columns used in Pony for _sorting_. diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_schema.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_schema.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/metadata_schema.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/metadata_schema.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/remote_query_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/remote_query_endpoint.py similarity index 94% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/remote_query_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/remote_query_endpoint.py index 43d03f479e9..f42bb72421a 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/remote_query_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/remote_query_endpoint.py @@ -11,8 +11,8 @@ from pony.orm import db_session -from tribler_core.modules.metadata_store.restapi.metadata_endpoint import MetadataEndpointBase -from tribler_core.modules.metadata_store.restapi.metadata_schema import RemoteQueryParameters +from tribler_core.components.metadata_store.restapi.metadata_endpoint import MetadataEndpointBase +from tribler_core.components.metadata_store.restapi.metadata_schema import RemoteQueryParameters from tribler_core.restapi.rest_endpoint import HTTP_BAD_REQUEST, RESTResponse from tribler_core.utilities.unicode import hexlify from tribler_core.utilities.utilities import froze_it diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/search_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/search_endpoint.py similarity index 94% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/search_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/search_endpoint.py index a9be583585d..6284cd0dbb3 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/search_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/search_endpoint.py @@ -8,9 +8,9 @@ from pony.orm import db_session -from tribler_core.modules.metadata_store.restapi.metadata_endpoint import MetadataEndpointBase -from tribler_core.modules.metadata_store.restapi.metadata_schema import MetadataParameters -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.restapi.metadata_endpoint import MetadataEndpointBase +from tribler_core.components.metadata_store.restapi.metadata_schema import MetadataParameters +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.restapi.rest_endpoint import HTTP_BAD_REQUEST, RESTResponse from tribler_core.utilities.utilities import froze_it diff --git a/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/conftest.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/conftest.py similarity index 96% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/conftest.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/tests/conftest.py index a46572a6b1e..b630f5ff18e 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/conftest.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/conftest.py @@ -6,7 +6,7 @@ import pytest -from tribler_core.modules.metadata_store.orm_bindings.channel_node import NEW +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW from tribler_core.utilities.random_utils import random_infohash diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_channels_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_channels_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py index f4d1a715307..8c0d20d9c0a 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_channels_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py @@ -15,10 +15,10 @@ from tribler_common.simpledefs import CHANNEL_STATE from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.community.gigachannel_community import NoChannelSourcesException -from tribler_core.modules.metadata_store.restapi.channels_endpoint import ChannelsEndpoint -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT -from tribler_core.modules.metadata_store.utils import RequestTimeoutException +from tribler_core.components.metadata_store.community.gigachannel_community import NoChannelSourcesException +from tribler_core.components.metadata_store.restapi.channels_endpoint import ChannelsEndpoint +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.utils import RequestTimeoutException from tribler_core.restapi.base_api_test import do_request from tribler_core.restapi.rest_manager import error_middleware from tribler_core.tests.tools.common import TORRENT_UBUNTU_FILE diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_metadata_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_metadata_endpoint.py similarity index 97% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_metadata_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_metadata_endpoint.py index fdc55443b8e..0432b107dc2 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_metadata_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_metadata_endpoint.py @@ -10,8 +10,8 @@ import pytest from tribler_core.config.tribler_config import TriblerConfig -from tribler_core.modules.metadata_store.orm_bindings.channel_node import COMMITTED, TODELETE, UPDATED -from tribler_core.modules.metadata_store.restapi.metadata_endpoint import MetadataEndpoint, TORRENT_CHECK_TIMEOUT +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import COMMITTED, TODELETE, UPDATED +from tribler_core.components.metadata_store.restapi.metadata_endpoint import MetadataEndpoint, TORRENT_CHECK_TIMEOUT from tribler_core.modules.torrent_checker.torrent_checker import TorrentChecker from tribler_core.restapi.base_api_test import do_request from tribler_core.restapi.rest_manager import error_middleware diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_remote_query_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_remote_query_endpoint.py similarity index 93% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_remote_query_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_remote_query_endpoint.py index e12e1094dac..5d35e14024d 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_remote_query_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_remote_query_endpoint.py @@ -10,8 +10,8 @@ import pytest -from tribler_core.modules.metadata_store.community.gigachannel_community import ChannelsPeersMapping -from tribler_core.modules.metadata_store.restapi.remote_query_endpoint import RemoteQueryEndpoint +from tribler_core.components.metadata_store.community.gigachannel_community import ChannelsPeersMapping +from tribler_core.components.metadata_store.restapi.remote_query_endpoint import RemoteQueryEndpoint from tribler_core.restapi.base_api_test import do_request from tribler_core.restapi.rest_manager import error_middleware from tribler_core.utilities.random_utils import random_infohash diff --git a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_search_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_search_endpoint.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_search_endpoint.py rename to src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_search_endpoint.py index 6d3a402b0db..c108ccfbc8c 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/restapi/tests/test_search_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_search_endpoint.py @@ -4,7 +4,7 @@ import pytest -from tribler_core.modules.metadata_store.restapi.search_endpoint import SearchEndpoint +from tribler_core.components.metadata_store.restapi.search_endpoint import SearchEndpoint from tribler_core.restapi.base_api_test import do_request from tribler_core.utilities.random_utils import random_infohash diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/gen_test_data.py b/src/tribler-core/tribler_core/components/metadata_store/tests/gen_test_data.py similarity index 91% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/gen_test_data.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/gen_test_data.py index 86750897b77..3bedc3f7c42 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/gen_test_data.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/gen_test_data.py @@ -7,9 +7,9 @@ from pony.orm import db_session from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.orm_bindings.channel_node import NEW -from tribler_core.modules.metadata_store.store import MetadataStore -from tribler_core.modules.metadata_store.tests.test_channel_download import ( +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW +from tribler_core.components.metadata_store.db.store import MetadataStore +from tribler_core.components.metadata_store.tests.test_channel_download import ( CHANNEL_METADATA, CHANNEL_METADATA_UPDATED, CHANNEL_TORRENT, diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_channel_download.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_download.py similarity index 95% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_channel_download.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_download.py index 6aaaf834957..e2f5a289f7e 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_channel_download.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_download.py @@ -12,8 +12,8 @@ from tribler_core.modules.libtorrent.download_manager import DownloadManager from tribler_core.modules.libtorrent.settings import LibtorrentSettings from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.manager.gigachannel_manager import GigaChannelManager -from tribler_core.modules.metadata_store.serialization import ChannelMetadataPayload +from tribler_core.components.metadata_store.manager.gigachannel_manager import GigaChannelManager +from tribler_core.components.metadata_store.db.serialization import ChannelMetadataPayload from tribler_core.tests.tools.common import TESTS_DATA_DIR CHANNEL_DIR = TESTS_DATA_DIR / 'sample_channel' diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_channel_metadata.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_metadata.py similarity index 99% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_channel_metadata.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_metadata.py index 80f9ba27907..7c7e5a1b67d 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_channel_metadata.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_metadata.py @@ -16,19 +16,19 @@ from tribler_common.simpledefs import CHANNEL_STATE from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import ( +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import ( CHANNEL_DIR_NAME_LENGTH, MetadataCompressor, entries_to_chunk, ) -from tribler_core.modules.metadata_store.orm_bindings.channel_node import COMMITTED, NEW, TODELETE, UPDATED -from tribler_core.modules.metadata_store.serialization import ( +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import COMMITTED, NEW, TODELETE, UPDATED +from tribler_core.components.metadata_store.db.serialization import ( CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT, int2time, ) -from tribler_core.modules.metadata_store.store import HealthItemsPayload +from tribler_core.components.metadata_store.db.store import HealthItemsPayload from tribler_core.tests.tools.common import TESTS_DATA_DIR, TORRENT_UBUNTU_FILE from tribler_core.utilities.random_utils import random_infohash diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_gigachannel_manager.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_gigachannel_manager.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py index 0f9b852543a..dd8ff43a82b 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_gigachannel_manager.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py @@ -13,8 +13,8 @@ from tribler_common.simpledefs import DLSTATUS_SEEDING from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.manager.gigachannel_manager import GigaChannelManager -from tribler_core.modules.metadata_store.orm_bindings.channel_node import NEW +from tribler_core.components.metadata_store.manager.gigachannel_manager import GigaChannelManager +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW from tribler_core.tests.tools.base_test import MockObject from tribler_core.tests.tools.common import TORRENT_UBUNTU_FILE from tribler_core.utilities.random_utils import random_infohash diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_metadata.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_metadata.py similarity index 98% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_metadata.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_metadata.py index 4fb6ccbbf85..0a4c1786284 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_metadata.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_metadata.py @@ -6,7 +6,7 @@ import pytest from tribler_core.exceptions import InvalidChannelNodeException, InvalidSignatureException -from tribler_core.modules.metadata_store.serialization import ( +from tribler_core.components.metadata_store.db.serialization import ( CHANNEL_NODE, ChannelNodePayload, KeysMismatchException, diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_store.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py similarity index 97% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_store.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py index b9878a70ff8..5c476208a53 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_store.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py @@ -12,10 +12,10 @@ import pytest -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH, entries_to_chunk -from tribler_core.modules.metadata_store.orm_bindings.channel_node import NEW -from tribler_core.modules.metadata_store.payload_checker import ObjState, ProcessingResult -from tribler_core.modules.metadata_store.serialization import ( +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH, entries_to_chunk +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW +from tribler_core.components.metadata_store.community.payload_checker import ObjState, ProcessingResult +from tribler_core.components.metadata_store.db.serialization import ( CHANNEL_TORRENT, ChannelMetadataPayload, DeletedMetadataPayload, @@ -23,7 +23,7 @@ UnknownBlobTypeException, int2time, ) -from tribler_core.modules.metadata_store.tests.test_channel_download import CHANNEL_METADATA_UPDATED +from tribler_core.components.metadata_store.tests.test_channel_download import CHANNEL_METADATA_UPDATED from tribler_core.tests.tools.common import TESTS_DATA_DIR from tribler_core.utilities.path_util import Path from tribler_core.utilities.random_utils import random_infohash diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_timeutils.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_timeutils.py similarity index 89% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_timeutils.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_timeutils.py index 0e9e7950e9e..2a9c4fdef91 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_timeutils.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_timeutils.py @@ -1,6 +1,6 @@ import datetime -from tribler_core.modules.metadata_store.serialization import EPOCH, int2time, time2int +from tribler_core.components.metadata_store.db.serialization import EPOCH, int2time, time2int def test_time_convert(): diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_torrent_metadata.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_torrent_metadata.py similarity index 97% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_torrent_metadata.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_torrent_metadata.py index 8a4ec467bb1..bbb055f51ba 100644 --- a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_torrent_metadata.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_torrent_metadata.py @@ -9,10 +9,10 @@ import pytest from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.discrete_clock import clock -from tribler_core.modules.metadata_store.orm_bindings.channel_node import TODELETE -from tribler_core.modules.metadata_store.orm_bindings.torrent_metadata import tdef_to_metadata_dict -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.orm_bindings.discrete_clock import clock +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import TODELETE +from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import tdef_to_metadata_dict +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, REGULAR_TORRENT from tribler_core.tests.tools.common import TORRENT_UBUNTU_FILE from tribler_core.utilities.random_utils import random_infohash diff --git a/src/tribler-core/tribler_core/modules/metadata_store/tests/test_tracker_state.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_tracker_state.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/tests/test_tracker_state.py rename to src/tribler-core/tribler_core/components/metadata_store/tests/test_tracker_state.py diff --git a/src/tribler-core/tribler_core/modules/metadata_store/utils.py b/src/tribler-core/tribler_core/components/metadata_store/utils.py similarity index 100% rename from src/tribler-core/tribler_core/modules/metadata_store/utils.py rename to src/tribler-core/tribler_core/components/metadata_store/utils.py diff --git a/src/tribler-core/tribler_core/components/popularity.py b/src/tribler-core/tribler_core/components/popularity.py index ff6924f9a36..b15d018cd78 100644 --- a/src/tribler-core/tribler_core/components/popularity.py +++ b/src/tribler-core/tribler_core/components/popularity.py @@ -5,7 +5,7 @@ from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.torrent_checker import TorrentCheckerComponent -from tribler_core.modules.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers from tribler_core.modules.popularity.community import PopularityCommunity INFINITE = -1 diff --git a/src/tribler-core/tribler_core/config/tribler_config_sections.py b/src/tribler-core/tribler_core/config/tribler_config_sections.py index 2a533a3980d..e1fdeeb3300 100644 --- a/src/tribler-core/tribler_core/config/tribler_config_sections.py +++ b/src/tribler-core/tribler_core/config/tribler_config_sections.py @@ -2,7 +2,7 @@ from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings from tribler_core.modules.libtorrent.settings import DownloadDefaultsSettings, LibtorrentSettings -from tribler_core.modules.metadata_store.settings import ChantSettings +from tribler_core.components.metadata_store.community.settings import ChantSettings from tribler_core.modules.popularity.settings import PopularityCommunitySettings from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings from tribler_core.modules.resource_monitor.settings import ResourceMonitorSettings diff --git a/src/tribler-core/tribler_core/conftest.py b/src/tribler-core/tribler_core/conftest.py index 74b97d574bd..90d9af97381 100644 --- a/src/tribler-core/tribler_core/conftest.py +++ b/src/tribler-core/tribler_core/conftest.py @@ -19,7 +19,7 @@ from tribler_core.modules.libtorrent.download_manager import DownloadManager from tribler_core.modules.libtorrent.settings import LibtorrentSettings from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.tests.tools.common import TESTS_DATA_DIR, TESTS_DIR from tribler_core.tests.tools.tracker.udp_tracker import UDPTracker from tribler_core.upgrade.legacy_to_pony import DispersyToPonyMigration diff --git a/src/tribler-core/tribler_core/modules/libtorrent/restapi/tests/test_torrentinfo_endpoint.py b/src/tribler-core/tribler_core/modules/libtorrent/restapi/tests/test_torrentinfo_endpoint.py index 5ba92bda08c..c12ace0bec4 100644 --- a/src/tribler-core/tribler_core/modules/libtorrent/restapi/tests/test_torrentinfo_endpoint.py +++ b/src/tribler-core/tribler_core/modules/libtorrent/restapi/tests/test_torrentinfo_endpoint.py @@ -15,7 +15,7 @@ from tribler_core.modules.libtorrent.restapi.torrentinfo_endpoint import TorrentInfoEndpoint from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.orm_bindings.torrent_metadata import tdef_to_metadata_dict +from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import tdef_to_metadata_dict from tribler_core.restapi.base_api_test import do_request from tribler_core.restapi.rest_manager import error_middleware from tribler_core.tests.tools.common import TESTS_DATA_DIR, TESTS_DIR, TORRENT_UBUNTU_FILE, UBUNTU_1504_INFOHASH diff --git a/src/tribler-core/tribler_core/modules/libtorrent/restapi/torrentinfo_endpoint.py b/src/tribler-core/tribler_core/modules/libtorrent/restapi/torrentinfo_endpoint.py index c9baf24a430..61304ff0de3 100644 --- a/src/tribler-core/tribler_core/modules/libtorrent/restapi/torrentinfo_endpoint.py +++ b/src/tribler-core/tribler_core/modules/libtorrent/restapi/torrentinfo_endpoint.py @@ -14,7 +14,7 @@ from tribler_common.utilities import uri_to_path from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.modules.metadata_store.orm_bindings.torrent_metadata import tdef_to_metadata_dict +from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import tdef_to_metadata_dict from tribler_core.restapi.rest_endpoint import HTTP_BAD_REQUEST, HTTP_INTERNAL_SERVER_ERROR, RESTEndpoint, RESTResponse from tribler_core.utilities.libtorrent_helper import libtorrent as lt from tribler_core.utilities.unicode import hexlify, recursive_unicode diff --git a/src/tribler-core/tribler_core/modules/metadata_store/__init__.py b/src/tribler-core/tribler_core/modules/metadata_store/__init__.py deleted file mode 100644 index c91630a987d..00000000000 --- a/src/tribler-core/tribler_core/modules/metadata_store/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -""" -Torrent metadata storage with ORM, signing it, serializing it to disk and -making torrents of it. -""" diff --git a/src/tribler-core/tribler_core/modules/popularity/tests/test_popularity_community.py b/src/tribler-core/tribler_core/modules/popularity/tests/test_popularity_community.py index a3a9e5efa1e..bd824f5e6e5 100644 --- a/src/tribler-core/tribler_core/modules/popularity/tests/test_popularity_community.py +++ b/src/tribler-core/tribler_core/modules/popularity/tests/test_popularity_community.py @@ -12,7 +12,7 @@ import pytest -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.modules.popularity.community import PopularityCommunity from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings from tribler_core.tests.tools.base_test import MockObject diff --git a/src/tribler-core/tribler_core/modules/remote_query_community/community.py b/src/tribler-core/tribler_core/modules/remote_query_community/community.py index 902d4b981d0..cb9258c47e6 100644 --- a/src/tribler-core/tribler_core/modules/remote_query_community/community.py +++ b/src/tribler-core/tribler_core/modules/remote_query_community/community.py @@ -9,11 +9,11 @@ from pony.orm.dbapiprovider import OperationalError -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import LZ4_EMPTY_ARCHIVE, entries_to_chunk -from tribler_core.modules.metadata_store.payload_checker import ObjState -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT -from tribler_core.modules.metadata_store.store import MetadataStore -from tribler_core.modules.metadata_store.utils import RequestTimeoutException +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import LZ4_EMPTY_ARCHIVE, entries_to_chunk +from tribler_core.components.metadata_store.community.payload_checker import ObjState +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.store import MetadataStore +from tribler_core.components.metadata_store.utils import RequestTimeoutException from tribler_core.modules.remote_query_community.eva_protocol import EVAProtocolMixin from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings from tribler_core.modules.tribler_community import TriblerCommunity diff --git a/src/tribler-core/tribler_core/modules/remote_query_community/tests/test_remote_query_community.py b/src/tribler-core/tribler_core/modules/remote_query_community/tests/test_remote_query_community.py index e909ed201ff..7372d4f0c25 100644 --- a/src/tribler-core/tribler_core/modules/remote_query_community/tests/test_remote_query_community.py +++ b/src/tribler-core/tribler_core/modules/remote_query_community/tests/test_remote_query_community.py @@ -15,9 +15,9 @@ import pytest -from tribler_core.modules.metadata_store.orm_bindings.channel_node import NEW -from tribler_core.modules.metadata_store.serialization import CHANNEL_THUMBNAIL, CHANNEL_TORRENT, REGULAR_TORRENT -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW +from tribler_core.components.metadata_store.db.serialization import CHANNEL_THUMBNAIL, CHANNEL_TORRENT, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.modules.remote_query_community.community import RemoteQueryCommunity, sanitize_query from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings from tribler_core.utilities.path_util import Path diff --git a/src/tribler-core/tribler_core/modules/torrent_checker/torrent_checker.py b/src/tribler-core/tribler_core/modules/torrent_checker/torrent_checker.py index d144e59fcb3..d6d1d046fa9 100644 --- a/src/tribler-core/tribler_core/modules/torrent_checker/torrent_checker.py +++ b/src/tribler-core/tribler_core/modules/torrent_checker/torrent_checker.py @@ -13,7 +13,7 @@ from tribler_core.config.tribler_config import TriblerConfig from tribler_core.modules.libtorrent.download_manager import DownloadManager -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.modules.torrent_checker.torrentchecker_session import ( FakeBep33DHTSession, FakeDHTSession, diff --git a/src/tribler-core/tribler_core/modules/torrent_checker/tracker_manager.py b/src/tribler-core/tribler_core/modules/torrent_checker/tracker_manager.py index b61b9b11a5b..04e229a810e 100644 --- a/src/tribler-core/tribler_core/modules/torrent_checker/tracker_manager.py +++ b/src/tribler-core/tribler_core/modules/torrent_checker/tracker_manager.py @@ -4,7 +4,7 @@ from pony.orm import count, db_session -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.utilities.tracker_utils import get_uniformed_tracker_url MAX_TRACKER_FAILURES = 5 # if a tracker fails this amount of times in a row, its 'is_alive' will be marked as 0 (dead). diff --git a/src/tribler-core/tribler_core/restapi/root_endpoint.py b/src/tribler-core/tribler_core/restapi/root_endpoint.py index f3d80e10d97..55174c48b0e 100644 --- a/src/tribler-core/tribler_core/restapi/root_endpoint.py +++ b/src/tribler-core/tribler_core/restapi/root_endpoint.py @@ -6,10 +6,10 @@ from tribler_core.modules.libtorrent.restapi.downloads_endpoint import DownloadsEndpoint from tribler_core.modules.libtorrent.restapi.libtorrent_endpoint import LibTorrentEndpoint from tribler_core.modules.libtorrent.restapi.torrentinfo_endpoint import TorrentInfoEndpoint -from tribler_core.modules.metadata_store.restapi.channels_endpoint import ChannelsEndpoint -from tribler_core.modules.metadata_store.restapi.metadata_endpoint import MetadataEndpoint -from tribler_core.modules.metadata_store.restapi.remote_query_endpoint import RemoteQueryEndpoint -from tribler_core.modules.metadata_store.restapi.search_endpoint import SearchEndpoint +from tribler_core.components.metadata_store.restapi.channels_endpoint import ChannelsEndpoint +from tribler_core.components.metadata_store.restapi.metadata_endpoint import MetadataEndpoint +from tribler_core.components.metadata_store.restapi.remote_query_endpoint import RemoteQueryEndpoint +from tribler_core.components.metadata_store.restapi.search_endpoint import SearchEndpoint from tribler_core.restapi.debug_endpoint import DebugEndpoint from tribler_core.restapi.events_endpoint import EventsEndpoint from tribler_core.restapi.rest_endpoint import RESTEndpoint diff --git a/src/tribler-core/tribler_core/upgrade/db8_to_db10.py b/src/tribler-core/tribler_core/upgrade/db8_to_db10.py index 466aa2f95a8..e033098fc18 100644 --- a/src/tribler-core/tribler_core/upgrade/db8_to_db10.py +++ b/src/tribler-core/tribler_core/upgrade/db8_to_db10.py @@ -8,7 +8,7 @@ from pony.orm import db_session -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.store import MetadataStore TABLE_NAMES = ( "ChannelNode", "TorrentState", "TorrentState_TrackerState", "ChannelPeer", "ChannelVote", "TrackerState", "Vsids") diff --git a/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py b/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py index 5e03930b58a..6ae91b03af5 100644 --- a/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py +++ b/src/tribler-core/tribler_core/upgrade/legacy_to_pony.py @@ -10,11 +10,11 @@ from pony.orm import db_session from tribler_core.components.metadata_store.category_filter.l2_filter import is_forbidden -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import BLOB_EXTENSION -from tribler_core.modules.metadata_store.orm_bindings.channel_node import LEGACY_ENTRY, NEW -from tribler_core.modules.metadata_store.orm_bindings.torrent_metadata import infohash_to_id -from tribler_core.modules.metadata_store.serialization import REGULAR_TORRENT, int2time, time2int -from tribler_core.modules.metadata_store.store import BETA_DB_VERSIONS, CURRENT_DB_VERSION +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import BLOB_EXTENSION +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import LEGACY_ENTRY, NEW +from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import infohash_to_id +from tribler_core.components.metadata_store.db.serialization import REGULAR_TORRENT, int2time, time2int +from tribler_core.components.metadata_store.db.store import BETA_DB_VERSIONS, CURRENT_DB_VERSION from tribler_core.utilities.path_util import Path from tribler_core.utilities.tracker_utils import get_uniformed_tracker_url diff --git a/src/tribler-core/tribler_core/upgrade/tests/test_legacy_to_pony.py b/src/tribler-core/tribler_core/upgrade/tests/test_legacy_to_pony.py index d9f24737ccc..08107d1c698 100644 --- a/src/tribler-core/tribler_core/upgrade/tests/test_legacy_to_pony.py +++ b/src/tribler-core/tribler_core/upgrade/tests/test_legacy_to_pony.py @@ -10,8 +10,8 @@ import pytest -from tribler_core.modules.metadata_store.orm_bindings.channel_node import COMMITTED, LEGACY_ENTRY -from tribler_core.modules.metadata_store.store import MetadataStore +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import COMMITTED, LEGACY_ENTRY +from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.tests.tools.common import TESTS_DATA_DIR from tribler_core.upgrade import legacy_to_pony from tribler_core.upgrade.legacy_to_pony import ( diff --git a/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py b/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py index 1d4e5292b61..71880edbe71 100644 --- a/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py +++ b/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py @@ -12,8 +12,8 @@ import tribler_core.utilities.permid as permid_module from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH -from tribler_core.modules.metadata_store.store import CURRENT_DB_VERSION, MetadataStore +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH +from tribler_core.components.metadata_store.db.store import CURRENT_DB_VERSION, MetadataStore from tribler_core.notifier import Notifier from tribler_core.tests.tools.common import TESTS_DATA_DIR from tribler_core.upgrade.db8_to_db10 import calc_progress diff --git a/src/tribler-core/tribler_core/upgrade/upgrade.py b/src/tribler-core/tribler_core/upgrade/upgrade.py index 640a1dd0297..df6df266cc0 100644 --- a/src/tribler-core/tribler_core/upgrade/upgrade.py +++ b/src/tribler-core/tribler_core/upgrade/upgrade.py @@ -9,9 +9,9 @@ from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase from tribler_core.components.metadata_store.category_filter.l2_filter import is_forbidden -from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT -from tribler_core.modules.metadata_store.store import ( +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT +from tribler_core.components.metadata_store.db.store import ( MetadataStore, sql_create_partial_index_channelnode_metadata_type, sql_create_partial_index_channelnode_subscribed, diff --git a/src/tribler-gui/tribler_gui/dialogs/addtopersonalchanneldialog.py b/src/tribler-gui/tribler_gui/dialogs/addtopersonalchanneldialog.py index 5f446fd25dd..4cb1ccbc5dd 100644 --- a/src/tribler-gui/tribler_gui/dialogs/addtopersonalchanneldialog.py +++ b/src/tribler-gui/tribler_gui/dialogs/addtopersonalchanneldialog.py @@ -4,7 +4,7 @@ from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QTreeWidgetItem -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE from tribler_gui.dialogs.dialogcontainer import DialogContainer from tribler_gui.dialogs.new_channel_dialog import NewChannelDialog diff --git a/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py b/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py index b80bbbb12e1..21d0fabb594 100644 --- a/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py +++ b/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py @@ -8,8 +8,8 @@ from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_common.simpledefs import CHANNEL_STATE -from tribler_core.modules.metadata_store.orm_bindings.channel_node import DIRTY_STATUSES, NEW -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import DIRTY_STATUSES, NEW +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE from tribler_gui.defs import BUTTON_TYPE_CONFIRM, BUTTON_TYPE_NORMAL, ContentCategories from tribler_gui.dialogs.confirmationdialog import ConfirmationDialog diff --git a/src/tribler-gui/tribler_gui/widgets/channelsmenulistwidget.py b/src/tribler-gui/tribler_gui/widgets/channelsmenulistwidget.py index 397a8527d22..11ba114b865 100644 --- a/src/tribler-gui/tribler_gui/widgets/channelsmenulistwidget.py +++ b/src/tribler-gui/tribler_gui/widgets/channelsmenulistwidget.py @@ -6,7 +6,7 @@ from tribler_common.simpledefs import CHANNEL_STATE -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT from tribler_gui.tribler_action_menu import TriblerActionMenu from tribler_gui.tribler_request_manager import TriblerNetworkRequest diff --git a/src/tribler-gui/tribler_gui/widgets/lazytableview.py b/src/tribler-gui/tribler_gui/widgets/lazytableview.py index f8199bb7658..f6a0b50c055 100644 --- a/src/tribler-gui/tribler_gui/widgets/lazytableview.py +++ b/src/tribler-gui/tribler_gui/widgets/lazytableview.py @@ -2,8 +2,7 @@ from PyQt5.QtGui import QGuiApplication, QMovie from PyQt5.QtWidgets import QAbstractItemView, QLabel, QTableView -from tribler_core.modules.metadata_store.orm_bindings.channel_node import LEGACY_ENTRY -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_gui.defs import COMMIT_STATUS_COMMITTED from tribler_gui.utilities import connect, data_item2uri, get_image_path, index2uri diff --git a/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py b/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py index 4fc86839870..736ebd4fe0e 100644 --- a/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py +++ b/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py @@ -8,7 +8,7 @@ from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect, get_ui_file_path, to_fts_query, tr diff --git a/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py b/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py index b41c8061a85..ca29dbee933 100644 --- a/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py +++ b/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py @@ -6,8 +6,7 @@ from tribler_common.simpledefs import CHANNEL_STATE -from tribler_core.modules.metadata_store.orm_bindings.channel_node import LEGACY_ENTRY -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_gui.defs import ( COMMIT_STATUS_COMMITTED, diff --git a/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py b/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py index b454b811e77..d59b39737c3 100644 --- a/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py +++ b/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py @@ -8,8 +8,8 @@ from tribler_common.simpledefs import CHANNELS_VIEW_UUID, CHANNEL_STATE -from tribler_core.modules.metadata_store.orm_bindings.channel_node import NEW -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_gui.defs import BITTORRENT_BIRTHDAY, COMMIT_STATUS_TODELETE, HEALTH_CHECKING from tribler_gui.tribler_request_manager import TriblerNetworkRequest diff --git a/src/tribler-gui/tribler_gui/widgets/triblertablecontrollers.py b/src/tribler-gui/tribler_gui/widgets/triblertablecontrollers.py index d68c8a9ddce..4acf9b621f2 100644 --- a/src/tribler-gui/tribler_gui/widgets/triblertablecontrollers.py +++ b/src/tribler-gui/tribler_gui/widgets/triblertablecontrollers.py @@ -12,7 +12,7 @@ from tribler_common.simpledefs import CHANNEL_STATE -from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_gui.defs import HEALTH_CHECKING, HEALTH_UNCHECKED from tribler_gui.tribler_action_menu import TriblerActionMenu From eb15bfdfe9dc999540d763df322ee53a9863c4d8 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:15:28 +0200 Subject: [PATCH 04/11] Merge gigachannel_manager --- .../{metadata_store/manager => gigachannel_manager}/__init__.py | 0 .../manager => gigachannel_manager}/gigachannel_manager.py | 0 .../gigachannel_manager_component.py} | 2 +- .../components/metadata_store/tests/test_channel_download.py | 2 +- .../components/metadata_store/tests/test_gigachannel_manager.py | 2 +- .../tribler_core/components/tests/test_tribler_components.py | 2 +- src/tribler-core/tribler_core/start_core.py | 2 +- 7 files changed, 5 insertions(+), 5 deletions(-) rename src/tribler-core/tribler_core/components/{metadata_store/manager => gigachannel_manager}/__init__.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store/manager => gigachannel_manager}/gigachannel_manager.py (100%) rename src/tribler-core/tribler_core/components/{gigachannel_manager.py => gigachannel_manager/gigachannel_manager_component.py} (95%) diff --git a/src/tribler-core/tribler_core/components/metadata_store/manager/__init__.py b/src/tribler-core/tribler_core/components/gigachannel_manager/__init__.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/manager/__init__.py rename to src/tribler-core/tribler_core/components/gigachannel_manager/__init__.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/manager/gigachannel_manager.py b/src/tribler-core/tribler_core/components/gigachannel_manager/gigachannel_manager.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/manager/gigachannel_manager.py rename to src/tribler-core/tribler_core/components/gigachannel_manager/gigachannel_manager.py diff --git a/src/tribler-core/tribler_core/components/gigachannel_manager.py b/src/tribler-core/tribler_core/components/gigachannel_manager/gigachannel_manager_component.py similarity index 95% rename from src/tribler-core/tribler_core/components/gigachannel_manager.py rename to src/tribler-core/tribler_core/components/gigachannel_manager/gigachannel_manager_component.py index 4e3b135c589..537fd8659eb 100644 --- a/src/tribler-core/tribler_core/components/gigachannel_manager.py +++ b/src/tribler-core/tribler_core/components/gigachannel_manager/gigachannel_manager_component.py @@ -3,7 +3,7 @@ from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent -from tribler_core.components.metadata_store.manager.gigachannel_manager import GigaChannelManager +from tribler_core.components.gigachannel_manager.gigachannel_manager import GigaChannelManager from tribler_core.restapi.rest_manager import RESTManager diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_download.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_download.py index e2f5a289f7e..8cc88e3edc7 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_download.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_channel_download.py @@ -12,7 +12,7 @@ from tribler_core.modules.libtorrent.download_manager import DownloadManager from tribler_core.modules.libtorrent.settings import LibtorrentSettings from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.components.metadata_store.manager.gigachannel_manager import GigaChannelManager +from tribler_core.components.gigachannel_manager.gigachannel_manager import GigaChannelManager from tribler_core.components.metadata_store.db.serialization import ChannelMetadataPayload from tribler_core.tests.tools.common import TESTS_DATA_DIR diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py index dd8ff43a82b..95301542472 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py @@ -13,7 +13,7 @@ from tribler_common.simpledefs import DLSTATUS_SEEDING from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.components.metadata_store.manager.gigachannel_manager import GigaChannelManager +from tribler_core.components.gigachannel_manager.gigachannel_manager import GigaChannelManager from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW from tribler_core.tests.tools.base_test import MockObject from tribler_core.tests.tools.common import TORRENT_UBUNTU_FILE diff --git a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py index 1b66b41a04b..1882cbf0eff 100644 --- a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py +++ b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py @@ -5,7 +5,7 @@ from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Session, SessionError from tribler_core.components.gigachannel import GigaChannelComponent -from tribler_core.components.gigachannel_manager import GigachannelManagerComponent +from tribler_core.components.gigachannel_manager.gigachannel_manager_component import GigachannelManagerComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent diff --git a/src/tribler-core/tribler_core/start_core.py b/src/tribler-core/tribler_core/start_core.py index 0d12a1f9779..f9a49bb33e7 100644 --- a/src/tribler-core/tribler_core/start_core.py +++ b/src/tribler-core/tribler_core/start_core.py @@ -16,7 +16,7 @@ from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Component, Session from tribler_core.components.gigachannel import GigaChannelComponent -from tribler_core.components.gigachannel_manager import GigachannelManagerComponent +from tribler_core.components.gigachannel_manager.gigachannel_manager_component import GigachannelManagerComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent From e6e18e82c11152febeaca1e70043fce582c602a1 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:20:43 +0200 Subject: [PATCH 05/11] Fix family filter --- src/tribler-core/tribler_core/components/gigachannel.py | 6 ++---- .../components/gigachannel_manager/tests/__init__.py | 0 .../tests/test_gigachannel_manager.py | 0 .../components/metadata_store/category_filter/category.py | 2 +- .../metadata_store/category_filter/family_filter.py | 2 +- .../components/metadata_store/category_filter/l2_filter.py | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 src/tribler-core/tribler_core/components/gigachannel_manager/tests/__init__.py rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel_manager}/tests/test_gigachannel_manager.py (100%) diff --git a/src/tribler-core/tribler_core/components/gigachannel.py b/src/tribler-core/tribler_core/components/gigachannel.py index d94c3cb7cad..cde2d1712d8 100644 --- a/src/tribler-core/tribler_core/components/gigachannel.py +++ b/src/tribler-core/tribler_core/components/gigachannel.py @@ -2,13 +2,11 @@ from ipv8_service import IPv8 from tribler_core.components.base import Component from tribler_core.components.ipv8 import Ipv8Component +from tribler_core.components.metadata_store.community.gigachannel_community import GigaChannelCommunity, \ + GigaChannelTestnetCommunity from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent -from tribler_core.components.metadata_store.community import ( - GigaChannelCommunity, - GigaChannelTestnetCommunity, -) from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers from tribler_core.restapi.rest_manager import RESTManager diff --git a/src/tribler-core/tribler_core/components/gigachannel_manager/tests/__init__.py b/src/tribler-core/tribler_core/components/gigachannel_manager/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py b/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/tests/test_gigachannel_manager.py rename to src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/category_filter/category.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/category.py index c3ddb7e5da9..82fc41bb4b0 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/category_filter/category.py +++ b/src/tribler-core/tribler_core/components/metadata_store/category_filter/category.py @@ -12,7 +12,7 @@ from tribler_core.utilities.install_dir import get_lib_path from tribler_core.utilities.unicode import recursive_unicode -CATEGORY_CONFIG_FILE = get_lib_path() / 'modules/category_filter/category.conf' +CATEGORY_CONFIG_FILE = get_lib_path() / 'components/metadata_store/category_filter/category.conf' def cmp_rank(a, b): diff --git a/src/tribler-core/tribler_core/components/metadata_store/category_filter/family_filter.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/family_filter.py index 365a2b9ae55..69ce82167dc 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/category_filter/family_filter.py +++ b/src/tribler-core/tribler_core/components/metadata_store/category_filter/family_filter.py @@ -10,7 +10,7 @@ WORDS_REGEXP = re.compile('[a-zA-Z0-9]+') -termfilename = get_lib_path() / 'modules' / 'category_filter' / 'filter_terms.filter' +termfilename = get_lib_path() / 'components' / 'metadata_store' /'category_filter' / 'filter_terms.filter' def initTerms(filename): diff --git a/src/tribler-core/tribler_core/components/metadata_store/category_filter/l2_filter.py b/src/tribler-core/tribler_core/components/metadata_store/category_filter/l2_filter.py index 5b0e0175d4d..e398dcca52c 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/category_filter/l2_filter.py +++ b/src/tribler-core/tribler_core/components/metadata_store/category_filter/l2_filter.py @@ -4,7 +4,7 @@ # !ACHTUNG! We must first read the line into a file, then release the lock, and only then pass it to regex compiler. # Otherwise, there is an annoying race condition that reads in an empty file! -with open(get_lib_path() / 'modules' / 'category_filter' / 'level2.regex', encoding="utf-8") as f: +with open(get_lib_path() / 'components' / 'metadata_store' / 'category_filter' / 'level2.regex', encoding="utf-8") as f: regex = f.read().strip() stoplist_expression = re.compile(regex, re.IGNORECASE) From 8883f6faa9a2256fc99508042637f874d5e72204 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:32:41 +0200 Subject: [PATCH 06/11] Fix tests --- .../community/tests/test_gigachannel_community.py | 2 +- .../metadata_store/restapi/tests/test_channels_endpoint.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py index b6df2041b6a..1969c00d404 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py +++ b/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py @@ -55,7 +55,7 @@ def create_node(self, *args, **kwargs): kwargs['metadata_store'] = metadata_store kwargs['settings'] = ChantSettings() kwargs['rqc_settings'] = RemoteQueryCommunitySettings() - with mock.patch('tribler_core.modules.metadata_store.community.gigachannel_community.DiscoveryBooster'): + with mock.patch('tribler_core.components.metadata_store.community.gigachannel_community.DiscoveryBooster'): node = super().create_node(*args, **kwargs) self.count += 1 return node diff --git a/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py index 8c0d20d9c0a..37794a809f4 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py @@ -571,7 +571,7 @@ async def _mock_fetch(*args): with open(TORRENT_UBUNTU_FILE, 'rb') as f: return f.read() - with patch('tribler_core.modules.metadata_store.restapi.channels_endpoint._fetch_uri', new=_mock_fetch): + with patch('tribler_core.components.metadata_store.restapi.channels_endpoint._fetch_uri', new=_mock_fetch): await do_request( rest_api, f'channels/{hexlify(my_channel.public_key)}/{my_channel.id_}/torrents', From 6edd033d57be12ce541fdcb69bcf1ab0bd15563d Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:44:49 +0200 Subject: [PATCH 07/11] Extract tests --- .../test_gigachannel_manager_component.py | 26 +++++++++++++++ .../tests/test_metadata_store_component.py | 23 +++++++++++++ .../tests/test_tribler_components.py | 33 +------------------ 3 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py create mode 100644 src/tribler-core/tribler_core/components/metadata_store/tests/test_metadata_store_component.py diff --git a/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py b/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py new file mode 100644 index 00000000000..4959cfefef5 --- /dev/null +++ b/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py @@ -0,0 +1,26 @@ +from unittest.mock import patch + +from tribler_core.components.base import Session +from tribler_core.components.gigachannel_manager.gigachannel_manager_component import GigachannelManagerComponent +from tribler_core.components.libtorrent import LibtorrentComponent +from tribler_core.components.masterkey import MasterKeyComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent +from tribler_core.components.restapi import RESTComponent +from tribler_core.components.socks_configurator import SocksServersComponent +# pylint: disable=protected-access +from tribler_core.restapi.rest_manager import RESTManager + + +async def test_gigachannel_manager_component(tribler_config): + components = [SocksServersComponent(), MasterKeyComponent(), RESTComponent(), MetadataStoreComponent(), + LibtorrentComponent(), GigachannelManagerComponent()] + session = Session(tribler_config, components) + with session: + comp = GigachannelManagerComponent.instance() + with patch.object(RESTManager, 'get_endpoint'): + await session.start() + + assert comp.gigachannel_manager + assert comp._rest_manager + + await session.shutdown() diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_metadata_store_component.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_metadata_store_component.py new file mode 100644 index 00000000000..9d4b6a51aa1 --- /dev/null +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_metadata_store_component.py @@ -0,0 +1,23 @@ +from unittest.mock import patch + +from tribler_core.components.base import Session +from tribler_core.components.masterkey import MasterKeyComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent +from tribler_core.components.restapi import RESTComponent +from tribler_core.restapi.rest_manager import RESTManager + + +# pylint: disable=protected-access + +async def test_metadata_store_component(tribler_config): + components = [MasterKeyComponent(), RESTComponent(), MetadataStoreComponent()] + session = Session(tribler_config, components) + with session: + comp = MetadataStoreComponent.instance() + with patch.object(RESTManager, 'get_endpoint'): + await session.start() + + assert comp.mds + assert comp._rest_manager + + await session.shutdown() diff --git a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py index 1882cbf0eff..9cce5f3e664 100644 --- a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py +++ b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py @@ -5,7 +5,6 @@ from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Session, SessionError from tribler_core.components.gigachannel import GigaChannelComponent -from tribler_core.components.gigachannel_manager.gigachannel_manager_component import GigachannelManagerComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent @@ -25,6 +24,7 @@ pytestmark = pytest.mark.asyncio + # pylint: disable=protected-access def test_session_context_manager(loop, tribler_config): @@ -62,8 +62,6 @@ async def test_masterkey_component(tribler_config): await session.shutdown() - - async def test_giga_channel_component(tribler_config): components = [MetadataStoreComponent(), RESTComponent(), MasterKeyComponent(), Ipv8Component(), GigaChannelComponent()] @@ -80,21 +78,6 @@ async def test_giga_channel_component(tribler_config): await session.shutdown() -async def test_gigachannel_manager_component(tribler_config): - components = [SocksServersComponent(), MasterKeyComponent(), RESTComponent(), MetadataStoreComponent(), - LibtorrentComponent(), GigachannelManagerComponent()] - session = Session(tribler_config, components) - with session: - comp = GigachannelManagerComponent.instance() - with patch.object(RESTManager, 'get_endpoint'): - await session.start() - - assert comp.gigachannel_manager - assert comp._rest_manager - - await session.shutdown() - - async def test_ipv8_component(tribler_config): components = [MasterKeyComponent(), RESTComponent(), Ipv8Component()] session = Session(tribler_config, components) @@ -127,20 +110,6 @@ async def test_libtorrent_component(tribler_config): await session.shutdown() -async def test_metadata_store_component(tribler_config): - components = [MasterKeyComponent(), RESTComponent(), MetadataStoreComponent()] - session = Session(tribler_config, components) - with session: - comp = MetadataStoreComponent.instance() - with patch.object(RESTManager, 'get_endpoint'): - await session.start() - - assert comp.mds - assert comp._rest_manager - - await session.shutdown() - - async def test_payout_component(tribler_config): components = [BandwidthAccountingComponent(), MasterKeyComponent(), RESTComponent(), Ipv8Component(), PayoutComponent()] From 43debeaaac9ab21f48db18696d11ffa1ca0bf6fa Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 11:46:26 +0200 Subject: [PATCH 08/11] PyLint --- .../db/orm_bindings/collection_node.py | 11 ++++++----- .../components/metadata_store/tests/test_store.py | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/collection_node.py b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/collection_node.py index cb6b0286def..2e7a8d7af3f 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/collection_node.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/orm_bindings/collection_node.py @@ -5,10 +5,6 @@ from pony.orm import db_session, select from tribler_common.simpledefs import CHANNEL_STATE - -from tribler_core.exceptions import DuplicateTorrentFileError -from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.components.metadata_store.db.orm_bindings.discrete_clock import clock from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import chunks from tribler_core.components.metadata_store.db.orm_bindings.channel_node import ( CHANNEL_DESCRIPTION_FLAG, @@ -19,10 +15,15 @@ TODELETE, UPDATED, ) +from tribler_core.components.metadata_store.db.orm_bindings.discrete_clock import clock from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import tdef_to_metadata_dict -from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, CollectionNodePayload +from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, \ + CollectionNodePayload +from tribler_core.exceptions import DuplicateTorrentFileError +from tribler_core.modules.libtorrent.torrentdef import TorrentDef from tribler_core.utilities.random_utils import random_infohash + # pylint: disable=too-many-statements diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py b/src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py index 5c476208a53..415aed2fed4 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py +++ b/src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py @@ -6,15 +6,14 @@ from datetime import datetime from unittest.mock import patch -from ipv8.keyvault.crypto import default_eccrypto - -from pony.orm import db_session - import pytest +from pony.orm import db_session -from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH, entries_to_chunk -from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW +from ipv8.keyvault.crypto import default_eccrypto from tribler_core.components.metadata_store.community.payload_checker import ObjState, ProcessingResult +from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH, \ + entries_to_chunk +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW from tribler_core.components.metadata_store.db.serialization import ( CHANNEL_TORRENT, ChannelMetadataPayload, @@ -28,6 +27,7 @@ from tribler_core.utilities.path_util import Path from tribler_core.utilities.random_utils import random_infohash + # pylint: disable=protected-access,unused-argument From be19d5e69479089bc76b2e2204a57f47a08cb2d3 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 12:38:52 +0200 Subject: [PATCH 09/11] Move db tests --- .../tribler_core/components/metadata_store/db/tests/__init__.py | 0 .../components/metadata_store/{ => db}/tests/test_store.py | 0 .../metadata_store/{ => db}/tests/test_torrent_metadata.py | 0 .../metadata_store/{ => db}/tests/test_tracker_state.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/tribler-core/tribler_core/components/metadata_store/db/tests/__init__.py rename src/tribler-core/tribler_core/components/metadata_store/{ => db}/tests/test_store.py (100%) rename src/tribler-core/tribler_core/components/metadata_store/{ => db}/tests/test_torrent_metadata.py (100%) rename src/tribler-core/tribler_core/components/metadata_store/{ => db}/tests/test_tracker_state.py (100%) diff --git a/src/tribler-core/tribler_core/components/metadata_store/db/tests/__init__.py b/src/tribler-core/tribler_core/components/metadata_store/db/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py b/src/tribler-core/tribler_core/components/metadata_store/db/tests/test_store.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/tests/test_store.py rename to src/tribler-core/tribler_core/components/metadata_store/db/tests/test_store.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_torrent_metadata.py b/src/tribler-core/tribler_core/components/metadata_store/db/tests/test_torrent_metadata.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/tests/test_torrent_metadata.py rename to src/tribler-core/tribler_core/components/metadata_store/db/tests/test_torrent_metadata.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/tests/test_tracker_state.py b/src/tribler-core/tribler_core/components/metadata_store/db/tests/test_tracker_state.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/tests/test_tracker_state.py rename to src/tribler-core/tribler_core/components/metadata_store/db/tests/test_tracker_state.py From d180617f8d2ac1227d23a6b9143c301460531ab1 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 12:43:37 +0200 Subject: [PATCH 10/11] Move gigachannel community to the corresponding component --- .../popularity_community/initial_filling.py | 2 +- src/seedbox/disseminator.py | 2 +- .../community => gigachannel}/__init__.py | 0 .../community}/__init__.py | 0 .../community/discovery_booster.py | 0 .../community/gigachannel_community.py | 4 +-- .../community/payload.py | 0 .../community/payload_checker.py | 0 .../community/request.py | 0 .../community/settings.py | 0 .../community/sync_strategy.py | 0 .../gigachannel/community/tests/__init__.py | 0 .../community/tests/test_discovery_booster.py | 2 +- .../tests/test_gigachannel_community.py | 4 +-- .../community/tests/test_sync_strategy.py | 2 +- .../gigachannel_component.py} | 4 +-- .../tests/test_gigachannel_component.py | 28 +++++++++++++++++++ .../test_gigachannel_manager_component.py | 3 +- .../components/metadata_store/db/store.py | 2 +- .../metadata_store/db/tests/test_store.py | 2 +- .../restapi/tests/test_channels_endpoint.py | 2 +- .../tests/test_remote_query_endpoint.py | 2 +- .../tribler_core/components/popularity.py | 2 +- .../tests/test_tribler_components.py | 18 +----------- .../config/tribler_config_sections.py | 2 +- .../remote_query_community/community.py | 2 +- src/tribler-core/tribler_core/start_core.py | 2 +- 27 files changed, 49 insertions(+), 36 deletions(-) rename src/tribler-core/tribler_core/components/{metadata_store/community => gigachannel}/__init__.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store/community/tests => gigachannel/community}/__init__.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/discovery_booster.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/gigachannel_community.py (98%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/payload.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/payload_checker.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/request.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/settings.py (100%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/sync_strategy.py (100%) create mode 100644 src/tribler-core/tribler_core/components/gigachannel/community/tests/__init__.py rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/tests/test_discovery_booster.py (94%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/tests/test_gigachannel_community.py (98%) rename src/tribler-core/tribler_core/components/{metadata_store => gigachannel}/community/tests/test_sync_strategy.py (95%) rename src/tribler-core/tribler_core/components/{gigachannel.py => gigachannel/gigachannel_component.py} (92%) create mode 100644 src/tribler-core/tribler_core/components/gigachannel/tests/test_gigachannel_component.py diff --git a/experiment/popularity_community/initial_filling.py b/experiment/popularity_community/initial_filling.py index 0bef4aae720..bc454716660 100644 --- a/experiment/popularity_community/initial_filling.py +++ b/experiment/popularity_community/initial_filling.py @@ -21,7 +21,7 @@ from tribler_core.components.socks_configurator import SocksServersComponent from tribler_core.components.torrent_checker import TorrentCheckerComponent from tribler_core.config.tribler_config import TriblerConfig -from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.gigachannel.community.sync_strategy import RemovePeers from tribler_core.modules.popularity.community import PopularityCommunity from tribler_core.utilities.tiny_tribler_service import TinyTriblerService diff --git a/src/seedbox/disseminator.py b/src/seedbox/disseminator.py index 3c7e4a926a1..b8f599bfa4e 100644 --- a/src/seedbox/disseminator.py +++ b/src/seedbox/disseminator.py @@ -30,7 +30,7 @@ import sentry_sdk from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.components.metadata_store.community import GigaChannelCommunity +from tribler_core.components.gigachannel.community import GigaChannelCommunity from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW from tribler_core.utilities.tiny_tribler_service import TinyTriblerService diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/__init__.py b/src/tribler-core/tribler_core/components/gigachannel/__init__.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/__init__.py rename to src/tribler-core/tribler_core/components/gigachannel/__init__.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/tests/__init__.py b/src/tribler-core/tribler_core/components/gigachannel/community/__init__.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/tests/__init__.py rename to src/tribler-core/tribler_core/components/gigachannel/community/__init__.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/discovery_booster.py b/src/tribler-core/tribler_core/components/gigachannel/community/discovery_booster.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/discovery_booster.py rename to src/tribler-core/tribler_core/components/gigachannel/community/discovery_booster.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/gigachannel_community.py b/src/tribler-core/tribler_core/components/gigachannel/community/gigachannel_community.py similarity index 98% rename from src/tribler-core/tribler_core/components/metadata_store/community/gigachannel_community.py rename to src/tribler-core/tribler_core/components/gigachannel/community/gigachannel_community.py index ba68ffe19f2..7ffc149db31 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/community/gigachannel_community.py +++ b/src/tribler-core/tribler_core/components/gigachannel/community/gigachannel_community.py @@ -11,8 +11,8 @@ from tribler_common.simpledefs import CHANNELS_VIEW_UUID, NTFY -from tribler_core.components.metadata_store.community.discovery_booster import DiscoveryBooster -from tribler_core.components.metadata_store.community.payload_checker import ObjState +from tribler_core.components.gigachannel.community.discovery_booster import DiscoveryBooster +from tribler_core.components.gigachannel.community.payload_checker import ObjState from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT from tribler_core.components.metadata_store.utils import NoChannelSourcesException from tribler_core.modules.remote_query_community.community import RemoteQueryCommunity diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/payload.py b/src/tribler-core/tribler_core/components/gigachannel/community/payload.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/payload.py rename to src/tribler-core/tribler_core/components/gigachannel/community/payload.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/payload_checker.py b/src/tribler-core/tribler_core/components/gigachannel/community/payload_checker.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/payload_checker.py rename to src/tribler-core/tribler_core/components/gigachannel/community/payload_checker.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/request.py b/src/tribler-core/tribler_core/components/gigachannel/community/request.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/request.py rename to src/tribler-core/tribler_core/components/gigachannel/community/request.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/settings.py b/src/tribler-core/tribler_core/components/gigachannel/community/settings.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/settings.py rename to src/tribler-core/tribler_core/components/gigachannel/community/settings.py diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/sync_strategy.py b/src/tribler-core/tribler_core/components/gigachannel/community/sync_strategy.py similarity index 100% rename from src/tribler-core/tribler_core/components/metadata_store/community/sync_strategy.py rename to src/tribler-core/tribler_core/components/gigachannel/community/sync_strategy.py diff --git a/src/tribler-core/tribler_core/components/gigachannel/community/tests/__init__.py b/src/tribler-core/tribler_core/components/gigachannel/community/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_discovery_booster.py b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_discovery_booster.py similarity index 94% rename from src/tribler-core/tribler_core/components/metadata_store/community/tests/test_discovery_booster.py rename to src/tribler-core/tribler_core/components/gigachannel/community/tests/test_discovery_booster.py index 1b36f99bdff..f2b8c34025f 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_discovery_booster.py +++ b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_discovery_booster.py @@ -1,6 +1,6 @@ import pytest -from tribler_core.components.metadata_store.community.discovery_booster import DiscoveryBooster +from tribler_core.components.gigachannel.community.discovery_booster import DiscoveryBooster TEST_BOOSTER_TIMEOUT_IN_SEC = 10 TEST_BOOSTER_TAKE_STEP_INTERVAL_IN_SEC = 1 diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_gigachannel_community.py similarity index 98% rename from src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py rename to src/tribler-core/tribler_core/components/gigachannel/community/tests/test_gigachannel_community.py index 1969c00d404..c2bbcad2cf6 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_gigachannel_community.py +++ b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_gigachannel_community.py @@ -11,12 +11,12 @@ import pytest -from tribler_core.components.metadata_store.community.gigachannel_community import ( +from tribler_core.components.gigachannel.community.gigachannel_community import ( ChannelsPeersMapping, GigaChannelCommunity, NoChannelSourcesException, ) -from tribler_core.components.metadata_store.community.settings import ChantSettings +from tribler_core.components.gigachannel.community.settings import ChantSettings from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.components.metadata_store.utils import RequestTimeoutException from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings diff --git a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_sync_strategy.py b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_sync_strategy.py similarity index 95% rename from src/tribler-core/tribler_core/components/metadata_store/community/tests/test_sync_strategy.py rename to src/tribler-core/tribler_core/components/gigachannel/community/tests/test_sync_strategy.py index b8b0a32baa7..b8ff9e2350b 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/community/tests/test_sync_strategy.py +++ b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_sync_strategy.py @@ -3,7 +3,7 @@ from ipv8.peerdiscovery.network import Network from ipv8.test.base import TestBase -from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.gigachannel.community.sync_strategy import RemovePeers class MockCommunity: diff --git a/src/tribler-core/tribler_core/components/gigachannel.py b/src/tribler-core/tribler_core/components/gigachannel/gigachannel_component.py similarity index 92% rename from src/tribler-core/tribler_core/components/gigachannel.py rename to src/tribler-core/tribler_core/components/gigachannel/gigachannel_component.py index cde2d1712d8..b7a86687bd0 100644 --- a/src/tribler-core/tribler_core/components/gigachannel.py +++ b/src/tribler-core/tribler_core/components/gigachannel/gigachannel_component.py @@ -2,12 +2,12 @@ from ipv8_service import IPv8 from tribler_core.components.base import Component from tribler_core.components.ipv8 import Ipv8Component -from tribler_core.components.metadata_store.community.gigachannel_community import GigaChannelCommunity, \ +from tribler_core.components.gigachannel.community.gigachannel_community import GigaChannelCommunity, \ GigaChannelTestnetCommunity from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent -from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.gigachannel.community.sync_strategy import RemovePeers from tribler_core.restapi.rest_manager import RESTManager INFINITE = -1 diff --git a/src/tribler-core/tribler_core/components/gigachannel/tests/test_gigachannel_component.py b/src/tribler-core/tribler_core/components/gigachannel/tests/test_gigachannel_component.py new file mode 100644 index 00000000000..5d9e7bd64ec --- /dev/null +++ b/src/tribler-core/tribler_core/components/gigachannel/tests/test_gigachannel_component.py @@ -0,0 +1,28 @@ +from unittest.mock import patch + +from tribler_core.components.base import Session +from tribler_core.components.gigachannel.gigachannel_component import GigaChannelComponent +from tribler_core.components.ipv8 import Ipv8Component +from tribler_core.components.masterkey import MasterKeyComponent +from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent +from tribler_core.components.restapi import RESTComponent +from tribler_core.restapi.rest_manager import RESTManager + + +# pylint: disable=protected-access + + +async def test_giga_channel_component(tribler_config): + components = [MetadataStoreComponent(), RESTComponent(), MasterKeyComponent(), Ipv8Component(), + GigaChannelComponent()] + session = Session(tribler_config, components) + with session: + comp = GigaChannelComponent.instance() + with patch.object(RESTManager, 'get_endpoint'): + await session.start() + + assert comp.community + assert comp._rest_manager + assert comp._ipv8 + + await session.shutdown() diff --git a/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py b/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py index 4959cfefef5..8ac64ac6c34 100644 --- a/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py +++ b/src/tribler-core/tribler_core/components/gigachannel_manager/tests/test_gigachannel_manager_component.py @@ -7,10 +7,11 @@ from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.restapi import RESTComponent from tribler_core.components.socks_configurator import SocksServersComponent -# pylint: disable=protected-access from tribler_core.restapi.rest_manager import RESTManager +# pylint: disable=protected-access + async def test_gigachannel_manager_component(tribler_config): components = [SocksServersComponent(), MasterKeyComponent(), RESTComponent(), MetadataStoreComponent(), LibtorrentComponent(), GigachannelManagerComponent()] diff --git a/src/tribler-core/tribler_core/components/metadata_store/db/store.py b/src/tribler-core/tribler_core/components/metadata_store/db/store.py index 269fa81d2ea..d729eb437a8 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/db/store.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/store.py @@ -33,7 +33,7 @@ from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import get_mdblob_sequence_number from tribler_core.components.metadata_store.db.orm_bindings.channel_node import LEGACY_ENTRY, TODELETE from tribler_core.components.metadata_store.db.orm_bindings.torrent_metadata import NULL_KEY_SUBST -from tribler_core.components.metadata_store.community.payload_checker import process_payload +from tribler_core.components.gigachannel.community.payload_checker import process_payload from tribler_core.components.metadata_store.db.serialization import ( BINARY_NODE, CHANNEL_DESCRIPTION, diff --git a/src/tribler-core/tribler_core/components/metadata_store/db/tests/test_store.py b/src/tribler-core/tribler_core/components/metadata_store/db/tests/test_store.py index 415aed2fed4..bb0f3075c8f 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/db/tests/test_store.py +++ b/src/tribler-core/tribler_core/components/metadata_store/db/tests/test_store.py @@ -10,7 +10,7 @@ from pony.orm import db_session from ipv8.keyvault.crypto import default_eccrypto -from tribler_core.components.metadata_store.community.payload_checker import ObjState, ProcessingResult +from tribler_core.components.gigachannel.community.payload_checker import ObjState, ProcessingResult from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH, \ entries_to_chunk from tribler_core.components.metadata_store.db.orm_bindings.channel_node import NEW diff --git a/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py index 37794a809f4..5efcd5ac211 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_channels_endpoint.py @@ -15,7 +15,7 @@ from tribler_common.simpledefs import CHANNEL_STATE from tribler_core.modules.libtorrent.torrentdef import TorrentDef -from tribler_core.components.metadata_store.community.gigachannel_community import NoChannelSourcesException +from tribler_core.components.gigachannel.community.gigachannel_community import NoChannelSourcesException from tribler_core.components.metadata_store.restapi.channels_endpoint import ChannelsEndpoint from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_core.components.metadata_store.utils import RequestTimeoutException diff --git a/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_remote_query_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_remote_query_endpoint.py index 5d35e14024d..eb59bd622e6 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_remote_query_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_remote_query_endpoint.py @@ -10,7 +10,7 @@ import pytest -from tribler_core.components.metadata_store.community.gigachannel_community import ChannelsPeersMapping +from tribler_core.components.gigachannel.community.gigachannel_community import ChannelsPeersMapping from tribler_core.components.metadata_store.restapi.remote_query_endpoint import RemoteQueryEndpoint from tribler_core.restapi.base_api_test import do_request from tribler_core.restapi.rest_manager import error_middleware diff --git a/src/tribler-core/tribler_core/components/popularity.py b/src/tribler-core/tribler_core/components/popularity.py index b15d018cd78..41fddb80ba4 100644 --- a/src/tribler-core/tribler_core/components/popularity.py +++ b/src/tribler-core/tribler_core/components/popularity.py @@ -5,7 +5,7 @@ from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent from tribler_core.components.reporter import ReporterComponent from tribler_core.components.torrent_checker import TorrentCheckerComponent -from tribler_core.components.metadata_store.community.sync_strategy import RemovePeers +from tribler_core.components.gigachannel.community.sync_strategy import RemovePeers from tribler_core.modules.popularity.community import PopularityCommunity INFINITE = -1 diff --git a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py index 9cce5f3e664..0884d4e127d 100644 --- a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py +++ b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py @@ -4,7 +4,7 @@ from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Session, SessionError -from tribler_core.components.gigachannel import GigaChannelComponent +from tribler_core.components.gigachannel.gigachannel_component import GigaChannelComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent @@ -62,22 +62,6 @@ async def test_masterkey_component(tribler_config): await session.shutdown() -async def test_giga_channel_component(tribler_config): - components = [MetadataStoreComponent(), RESTComponent(), MasterKeyComponent(), Ipv8Component(), - GigaChannelComponent()] - session = Session(tribler_config, components) - with session: - comp = GigaChannelComponent.instance() - with patch.object(RESTManager, 'get_endpoint'): - await session.start() - - assert comp.community - assert comp._rest_manager - assert comp._ipv8 - - await session.shutdown() - - async def test_ipv8_component(tribler_config): components = [MasterKeyComponent(), RESTComponent(), Ipv8Component()] session = Session(tribler_config, components) diff --git a/src/tribler-core/tribler_core/config/tribler_config_sections.py b/src/tribler-core/tribler_core/config/tribler_config_sections.py index e1fdeeb3300..56a80ba4cec 100644 --- a/src/tribler-core/tribler_core/config/tribler_config_sections.py +++ b/src/tribler-core/tribler_core/config/tribler_config_sections.py @@ -2,7 +2,7 @@ from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings from tribler_core.modules.libtorrent.settings import DownloadDefaultsSettings, LibtorrentSettings -from tribler_core.components.metadata_store.community.settings import ChantSettings +from tribler_core.components.gigachannel.community.settings import ChantSettings from tribler_core.modules.popularity.settings import PopularityCommunitySettings from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings from tribler_core.modules.resource_monitor.settings import ResourceMonitorSettings diff --git a/src/tribler-core/tribler_core/modules/remote_query_community/community.py b/src/tribler-core/tribler_core/modules/remote_query_community/community.py index cb9258c47e6..35ff1b59513 100644 --- a/src/tribler-core/tribler_core/modules/remote_query_community/community.py +++ b/src/tribler-core/tribler_core/modules/remote_query_community/community.py @@ -10,7 +10,7 @@ from pony.orm.dbapiprovider import OperationalError from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import LZ4_EMPTY_ARCHIVE, entries_to_chunk -from tribler_core.components.metadata_store.community.payload_checker import ObjState +from tribler_core.components.gigachannel.community.payload_checker import ObjState from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_core.components.metadata_store.db.store import MetadataStore from tribler_core.components.metadata_store.utils import RequestTimeoutException diff --git a/src/tribler-core/tribler_core/start_core.py b/src/tribler-core/tribler_core/start_core.py index f9a49bb33e7..c1672bcb99a 100644 --- a/src/tribler-core/tribler_core/start_core.py +++ b/src/tribler-core/tribler_core/start_core.py @@ -15,7 +15,7 @@ from tribler_core.check_os import check_and_enable_code_tracing, set_process_priority from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Component, Session -from tribler_core.components.gigachannel import GigaChannelComponent +from tribler_core.components.gigachannel.gigachannel_component import GigaChannelComponent from tribler_core.components.gigachannel_manager.gigachannel_manager_component import GigachannelManagerComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent From 4467ae35d428bf2c0dbd6f7369c898d1137ef856 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 28 Sep 2021 13:05:40 +0200 Subject: [PATCH 11/11] Fix tests and pylint --- .../gigachannel/community/tests/test_gigachannel_community.py | 2 +- .../tribler_core/components/tests/test_tribler_components.py | 1 - src/tribler-gui/tribler_gui/widgets/lazytableview.py | 1 + src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py | 1 + 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_gigachannel_community.py b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_gigachannel_community.py index c2bbcad2cf6..552729d93ea 100644 --- a/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_gigachannel_community.py +++ b/src/tribler-core/tribler_core/components/gigachannel/community/tests/test_gigachannel_community.py @@ -55,7 +55,7 @@ def create_node(self, *args, **kwargs): kwargs['metadata_store'] = metadata_store kwargs['settings'] = ChantSettings() kwargs['rqc_settings'] = RemoteQueryCommunitySettings() - with mock.patch('tribler_core.components.metadata_store.community.gigachannel_community.DiscoveryBooster'): + with mock.patch('tribler_core.components.gigachannel.community.gigachannel_community.DiscoveryBooster'): node = super().create_node(*args, **kwargs) self.count += 1 return node diff --git a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py index 0884d4e127d..cbdcd159c6d 100644 --- a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py +++ b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py @@ -4,7 +4,6 @@ from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Session, SessionError -from tribler_core.components.gigachannel.gigachannel_component import GigaChannelComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.masterkey import MasterKeyComponent diff --git a/src/tribler-gui/tribler_gui/widgets/lazytableview.py b/src/tribler-gui/tribler_gui/widgets/lazytableview.py index f6a0b50c055..1973fed8363 100644 --- a/src/tribler-gui/tribler_gui/widgets/lazytableview.py +++ b/src/tribler-gui/tribler_gui/widgets/lazytableview.py @@ -2,6 +2,7 @@ from PyQt5.QtGui import QGuiApplication, QMovie from PyQt5.QtWidgets import QAbstractItemView, QLabel, QTableView +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import LEGACY_ENTRY from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT from tribler_gui.defs import COMMIT_STATUS_COMMITTED diff --git a/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py b/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py index ca29dbee933..1e1cd629193 100644 --- a/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py +++ b/src/tribler-gui/tribler_gui/widgets/tablecontentdelegate.py @@ -5,6 +5,7 @@ from PyQt5.QtWidgets import QComboBox, QStyle, QStyledItemDelegate, QToolTip from tribler_common.simpledefs import CHANNEL_STATE +from tribler_core.components.metadata_store.db.orm_bindings.channel_node import LEGACY_ENTRY from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT