Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e9ef69bd3 |
No files matched your search
+1
-1
@@ -1,2 +1,2 @@
|
||||
__version__ = "0.60.0"
|
||||
__version__ = "0.59.1"
|
||||
version = tuple(map(int, __version__.split('.'))) # pylint: disable=invalid-name
|
||||
+1
-1
@@ -601,7 +601,7 @@ class Config(CLIConfig):
|
||||
save_files = Toggle("Save downloaded files when calling `get` by default", True)
|
||||
components_to_skip = Strings("components which will be skipped during start-up of daemon", [])
|
||||
share_usage_data = Toggle(
|
||||
"Whether to share usage stats and diagnostic info with LBRY.", False,
|
||||
"Whether to share usage stats and diagnostic info with LBRY.", True,
|
||||
previous_names=['upload_log', 'upload_log', 'share_debug_info']
|
||||
)
|
||||
track_bandwidth = Toggle("Track bandwidth usage", True)
|
||||
|
||||
@@ -2179,7 +2179,12 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
return paginate_rows(claims, claim_count, page, page_size, claim_type=claim_type, resolve=resolve)
|
||||
|
||||
@requires(WALLET_COMPONENT)
|
||||
async def jsonrpc_claim_search(self, **kwargs):
|
||||
async def jsonrpc_claim_search(self, claim_ids=None, channel_ids=None, not_channel_ids=None,
|
||||
has_channel_signature=False, valid_channel_signature=False,
|
||||
invalid_channel_signature=False, is_controlling=False, stream_types=None,
|
||||
media_types=None, any_tags=None, all_tags=None, not_tags=None, any_languages=None,
|
||||
all_languages=None, not_languages=None, any_locations=None, all_locations=None,
|
||||
not_locations=None, order_by=None, **kwargs):
|
||||
"""
|
||||
Search for stream and channel claims on the blockchain.
|
||||
|
||||
@@ -2316,23 +2321,50 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
Returns: {Paginated[Output]}
|
||||
"""
|
||||
wallet = self.wallet_manager.get_wallet_or_default(kwargs.pop('wallet_id', None))
|
||||
if {'claim_id', 'claim_ids'}.issubset(kwargs):
|
||||
|
||||
_kwargs = {}
|
||||
_kwargs.update(kwargs)
|
||||
_kwargs.update(
|
||||
{
|
||||
'claim_ids': claim_ids or [],
|
||||
'channel_ids': channel_ids or [],
|
||||
'not_channel_ids': not_channel_ids or [],
|
||||
'has_channel_signature': has_channel_signature,
|
||||
'valid_channel_signature': valid_channel_signature,
|
||||
'invalid_channel_signature': invalid_channel_signature,
|
||||
'is_controlling': is_controlling,
|
||||
'stream_types': stream_types or [],
|
||||
'media_types': media_types or [],
|
||||
'any_tags': any_tags or [],
|
||||
'all_tags': all_tags or [],
|
||||
'not_tags': not_tags or [],
|
||||
'any_languages': any_languages or [],
|
||||
'all_languages': all_languages or [],
|
||||
'not_languages': not_languages or [],
|
||||
'any_locations': any_locations or [],
|
||||
'all_locations': all_locations or [],
|
||||
'not_locations': not_locations or [],
|
||||
'order_by': order_by or []
|
||||
}
|
||||
)
|
||||
wallet = self.wallet_manager.get_wallet_or_default(_kwargs.pop('wallet_id', None))
|
||||
if {'claim_id', 'claim_ids'}.issubset(_kwargs):
|
||||
raise ValueError("Only 'claim_id' or 'claim_ids' is allowed, not both.")
|
||||
if kwargs.pop('valid_channel_signature', False):
|
||||
kwargs['signature_valid'] = 1
|
||||
if kwargs.pop('invalid_channel_signature', False):
|
||||
kwargs['signature_valid'] = 0
|
||||
page_num, page_size = abs(kwargs.pop('page', 1)), min(abs(kwargs.pop('page_size', DEFAULT_PAGE_SIZE)), 50)
|
||||
kwargs.update({'offset': page_size * (page_num - 1), 'limit': page_size})
|
||||
txos, blocked, _, total = await self.ledger.claim_search(wallet.accounts, **kwargs)
|
||||
if _kwargs.pop('valid_channel_signature', False):
|
||||
_kwargs['signature_valid'] = 1
|
||||
if _kwargs.pop('invalid_channel_signature', False):
|
||||
_kwargs['signature_valid'] = 0
|
||||
|
||||
page_num, page_size = abs(_kwargs.pop('page', 1)), min(abs(_kwargs.pop('page_size', DEFAULT_PAGE_SIZE)), 50)
|
||||
_kwargs.update({'offset': page_size * (page_num - 1), 'limit': page_size})
|
||||
txos, blocked, _, total = await self.ledger.claim_search(wallet.accounts, **_kwargs)
|
||||
result = {
|
||||
"items": txos,
|
||||
"blocked": blocked,
|
||||
"page": page_num,
|
||||
"page_size": page_size
|
||||
}
|
||||
if not kwargs.pop('no_totals', False):
|
||||
if not _kwargs.pop('no_totals', False):
|
||||
result['total_pages'] = int((total + (page_size - 1)) / page_size)
|
||||
result['total_items'] = total
|
||||
return result
|
||||
|
||||
@@ -130,42 +130,35 @@ class SQLDB:
|
||||
-- used by any tag clouds
|
||||
create index if not exists tag_tag_idx on tag (tag, claim_hash);
|
||||
|
||||
-- naked order bys (no filters)
|
||||
create unique index if not exists claim_release_idx on claim (release_time, claim_hash);
|
||||
create unique index if not exists claim_trending_idx on claim (trending_group, trending_mixed, claim_hash);
|
||||
create unique index if not exists claim_effective_amount_idx on claim (effective_amount, claim_hash);
|
||||
-- common ORDER BY
|
||||
create unique index if not exists claim_effective_amount_idx on claim (effective_amount, claim_hash, release_time);
|
||||
create unique index if not exists claim_release_time_idx on claim (release_time, claim_hash);
|
||||
create unique index if not exists claim_trending_global_mixed_idx on claim (trending_global, trending_mixed, claim_hash);
|
||||
create unique index if not exists claim_trending_group_mixed_idx on claim (trending_group, trending_mixed, claim_hash);
|
||||
create unique index if not exists filter_fee_amount_order_release_time_idx on claim (fee_amount, release_time, claim_hash);
|
||||
|
||||
-- claim_type filter + order by
|
||||
create unique index if not exists claim_type_trending_idx on claim (claim_type, trending_global, trending_mixed, claim_hash);
|
||||
create unique index if not exists claim_type_release_idx on claim (claim_type, release_time, claim_hash);
|
||||
create unique index if not exists claim_type_trending_idx on claim (claim_type, trending_group, trending_mixed, claim_hash);
|
||||
create unique index if not exists claim_type_effective_amount_idx on claim (claim_type, effective_amount, claim_hash);
|
||||
|
||||
-- stream_type filter + order by
|
||||
create unique index if not exists stream_type_release_idx on claim (stream_type, release_time, claim_hash);
|
||||
create unique index if not exists stream_type_trending_idx on claim (stream_type, trending_group, trending_mixed, claim_hash);
|
||||
create unique index if not exists stream_type_effective_amount_idx on claim (stream_type, effective_amount, claim_hash);
|
||||
create unique index if not exists channel_hash_release_time_idx on claim (channel_hash, release_time, claim_hash);
|
||||
create unique index if not exists channel_hash_trending_idx on claim (channel_hash, trending_global, trending_mixed, claim_hash);
|
||||
create unique index if not exists channel_hash_trending_idx on claim (channel_hash, effective_amount, claim_hash);
|
||||
|
||||
-- channel_hash filter + order by
|
||||
create unique index if not exists channel_hash_release_idx on claim (channel_hash, release_time, claim_hash);
|
||||
create unique index if not exists channel_hash_trending_idx on claim (channel_hash, trending_group, trending_mixed, claim_hash);
|
||||
create unique index if not exists channel_hash_effective_amount_idx on claim (channel_hash, effective_amount, claim_hash);
|
||||
|
||||
-- duration filter + order by
|
||||
create unique index if not exists duration_release_idx on claim (duration, release_time, claim_hash);
|
||||
create unique index if not exists duration_trending_idx on claim (duration, trending_group, trending_mixed, claim_hash);
|
||||
create unique index if not exists duration_effective_amount_idx on claim (duration, effective_amount, claim_hash);
|
||||
|
||||
-- fee_amount + order by
|
||||
create unique index if not exists fee_amount_release_idx on claim (fee_amount, release_time, claim_hash);
|
||||
create unique index if not exists fee_amount_trending_idx on claim (fee_amount, trending_group, trending_mixed, claim_hash);
|
||||
create unique index if not exists fee_amount_effective_amount_idx on claim (fee_amount, effective_amount, claim_hash);
|
||||
create unique index if not exists filter_stream_duration_idx on claim (duration, trending_global, trending_mixed, claim_hash);
|
||||
|
||||
-- TODO: verify that all indexes below are used
|
||||
create index if not exists claim_height_normalized_idx on claim (height, normalized asc);
|
||||
|
||||
create index if not exists claim_resolve_idx on claim (normalized, claim_id);
|
||||
|
||||
create index if not exists claim_id_idx on claim (claim_id, claim_hash);
|
||||
create index if not exists claim_timestamp_idx on claim (timestamp);
|
||||
create index if not exists claim_public_key_hash_idx on claim (public_key_hash);
|
||||
|
||||
create index if not exists claim_stream_type_idx on claim (stream_type);
|
||||
create index if not exists claim_media_type_idx on claim (media_type);
|
||||
|
||||
create index if not exists claim_signature_valid_idx on claim (signature_valid);
|
||||
"""
|
||||
|
||||
|
||||
@@ -122,10 +122,6 @@ async def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None):
|
||||
|
||||
|
||||
class TestStreamManager(BlobExchangeTestBase):
|
||||
async def asyncSetUp(self):
|
||||
await super().asyncSetUp()
|
||||
self.client_config.share_usage_data = True
|
||||
|
||||
async def setup_stream_manager(self, balance=10.0, fee=None, old_sort=False):
|
||||
file_path = os.path.join(self.server_dir, "test_file")
|
||||
with open(file_path, 'wb') as f:
|
||||
|
||||
@@ -80,25 +80,27 @@ class CLILoggingTest(AsyncioTestCase):
|
||||
self.assertFalse(log.getChild("torba").isEnabledFor(logging.DEBUG))
|
||||
|
||||
async def test_loggly(self):
|
||||
async with get_logger(["start"]) as log: # default share_usage_data=False
|
||||
async with get_logger(["start"], share_usage_data=False) as log:
|
||||
self.assertEqual(len(log.getChild("lbry").handlers), 2) # file and console
|
||||
async with get_logger(["start"], share_usage_data=True) as log:
|
||||
async with get_logger(["start"]) as log: # default share_usage_data=True
|
||||
log = log.getChild("lbry")
|
||||
self.assertEqual(len(log.handlers), 3)
|
||||
self.assertIsInstance(log.handlers[2], HTTPSLogglyHandler)
|
||||
async with get_logger(["start"], share_usage_data=False) as log: # explicit share_usage_data=False
|
||||
async with get_logger(["start"], share_usage_data=True) as log: # explicit share_usage_data=True
|
||||
log = log.getChild("lbry")
|
||||
self.assertEqual(len(log.handlers), 2)
|
||||
self.assertEqual(len(log.handlers), 3)
|
||||
self.assertIsInstance(log.handlers[2], HTTPSLogglyHandler)
|
||||
|
||||
async def test_quiet(self):
|
||||
async with get_logger(["start"]) as log: # default is loud
|
||||
log = log.getChild("lbry")
|
||||
self.assertEqual(len(log.handlers), 2)
|
||||
self.assertEqual(len(log.handlers), 3)
|
||||
self.assertIs(type(log.handlers[1]), logging.StreamHandler)
|
||||
async with get_logger(["start", "--quiet"]) as log:
|
||||
log = log.getChild("lbry")
|
||||
self.assertEqual(len(log.handlers), 1)
|
||||
self.assertEqual(len(log.handlers), 2)
|
||||
self.assertIsNot(type(log.handlers[0]), logging.StreamHandler)
|
||||
self.assertIsNot(type(log.handlers[1]), logging.StreamHandler)
|
||||
|
||||
|
||||
class CLITest(AsyncioTestCase):
|
||||
|
||||
Reference in new issue
Block a user