protobuf changes

more protobuf changes (fix imports)
This commit is contained in:
Jeffrey Picard 2021-06-08 21:19:43 -04:00 committed by Victor Shyba
parent a97fc6dba8
commit 886587848b
2 changed files with 50 additions and 16 deletions

View file

@ -21,7 +21,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
syntax='proto3',
serialized_options=b'Z$github.com/lbryio/hub/protobuf/go/pb',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\thub.proto\x12\x02pb\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x0cresult.proto\"0\n\x0fInvertibleField\x12\x0e\n\x06invert\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x03(\t\"j\n\nRangeField\x12\x1d\n\x02op\x18\x01 \x01(\x0e\x32\x11.pb.RangeField.Op\x12\r\n\x05value\x18\x02 \x03(\t\".\n\x02Op\x12\x06\n\x02\x45Q\x10\x00\x12\x07\n\x03LTE\x10\x01\x12\x07\n\x03GTE\x10\x02\x12\x06\n\x02LT\x10\x03\x12\x06\n\x02GT\x10\x04\"\xc5\x0f\n\rSearchRequest\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x03(\t\x12\x31\n\x0c\x61mount_order\x18\x03 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12*\n\x05limit\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x10\n\x08order_by\x18\x05 \x03(\t\x12+\n\x06offset\x18\x06 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x32\n\x0eis_controlling\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x1d\n\x15last_take_over_height\x18\x13 \x01(\t\x12%\n\x08\x63laim_id\x18\x14 \x01(\x0b\x32\x13.pb.InvertibleField\x12\x12\n\nclaim_name\x18\x16 \x03(\t\x12\x12\n\nnormalized\x18\x17 \x03(\t\x12#\n\x0btx_position\x18\x18 \x01(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06\x61mount\x18\x19 \x01(\x0b\x32\x0e.pb.RangeField\x12!\n\ttimestamp\x18\x1a \x01(\x0b\x32\x0e.pb.RangeField\x12*\n\x12\x63reation_timestamp\x18\x1b \x01(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06height\x18\x1c \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0f\x63reation_height\x18\x1d \x01(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x61\x63tivation_height\x18\x1e \x01(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x65xpiration_height\x18\x1f \x01(\x0b\x32\x0e.pb.RangeField\x12$\n\x0crelease_time\x18 \x01(\x0b\x32\x0e.pb.RangeField\x12\x11\n\tshort_url\x18! \x03(\t\x12\x15\n\rcanonical_url\x18\" \x03(\t\x12\r\n\x05title\x18# \x03(\t\x12\x0e\n\x06\x61uthor\x18$ \x03(\t\x12\x13\n\x0b\x64\x65scription\x18% \x03(\t\x12\x12\n\nclaim_type\x18& \x03(\t\x12 \n\x08reposted\x18\' \x01(\x0b\x32\x0e.pb.RangeField\x12\x13\n\x0bstream_type\x18( \x03(\t\x12\x12\n\nmedia_type\x18) \x03(\t\x12\"\n\nfee_amount\x18* \x01(\x0b\x32\x0e.pb.RangeField\x12\x14\n\x0c\x66\x65\x65_currency\x18+ \x03(\t\x12 \n\x08\x64uration\x18, \x01(\x0b\x32\x0e.pb.RangeField\x12\x1b\n\x13reposted_claim_hash\x18- \x01(\t\x12#\n\x0b\x63\x65nsor_type\x18. \x01(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11\x63laims_in_channel\x18/ \x01(\t\x12$\n\x0c\x63hannel_join\x18\x30 \x01(\x0b\x32\x0e.pb.RangeField\x12\x33\n\x0fsignature_valid\x18\x31 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12(\n\x10\x65\x66\x66\x65\x63tive_amount\x18\x33 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0esupport_amount\x18\x34 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_group\x18\x35 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_mixed\x18\x36 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_local\x18\x37 \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0ftrending_global\x18\x38 \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\nchannel_id\x18\x39 \x01(\x0b\x32\x13.pb.InvertibleField\x12(\n\x0b\x63hannel_ids\x18: \x01(\x0b\x32\x13.pb.InvertibleField\x12\r\n\x05tx_id\x18; \x03(\t\x12,\n\x07tx_nout\x18< \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x11\n\tsignature\x18= \x03(\t\x12\x18\n\x10signature_digest\x18> \x03(\t\x12\x18\n\x10public_key_bytes\x18? \x03(\t\x12\x17\n\x0fpublic_key_hash\x18@ \x03(\t\x12\x15\n\rpublic_key_id\x18\x41 \x01(\t\x12\x0b\n\x03_id\x18\x42 \x03(\x0c\x12\x10\n\x08\x61ny_tags\x18\x43 \x03(\t\x12\x10\n\x08\x61ll_tags\x18\x44 \x03(\t\x12\x10\n\x08not_tags\x18\x45 \x03(\t\x12\x19\n\x11reposted_claim_id\x18\x46 \x03(\t\x12\x39\n\x15has_channel_signature\x18G \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12.\n\nhas_source\x18H \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12=\n\x18limit_claims_per_channel\x18I \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x15\n\rany_languages\x18J \x03(\t\x12\x15\n\rall_languages\x18K \x03(\t21\n\x03Hub\x12*\n\x06Search\x12\x11.pb.SearchRequest\x1a\x0b.pb.Outputs\"\x00\x42&Z$github.com/lbryio/hub/protobuf/go/pbb\x06proto3'
serialized_pb=b'\n\thub.proto\x12\x02pb\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x0cresult.proto\"0\n\x0fInvertibleField\x12\x0e\n\x06invert\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x03(\t\"j\n\nRangeField\x12\x1d\n\x02op\x18\x01 \x01(\x0e\x32\x11.pb.RangeField.Op\x12\r\n\x05value\x18\x02 \x03(\t\".\n\x02Op\x12\x06\n\x02\x45Q\x10\x00\x12\x07\n\x03LTE\x10\x01\x12\x07\n\x03GTE\x10\x02\x12\x06\n\x02LT\x10\x03\x12\x06\n\x02GT\x10\x04\"\xfc\x0f\n\rSearchRequest\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x03(\t\x12\x31\n\x0c\x61mount_order\x18\x03 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12*\n\x05limit\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x10\n\x08order_by\x18\x05 \x03(\t\x12+\n\x06offset\x18\x06 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x32\n\x0eis_controlling\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x1d\n\x15last_take_over_height\x18\x13 \x01(\t\x12%\n\x08\x63laim_id\x18\x14 \x01(\x0b\x32\x13.pb.InvertibleField\x12\x12\n\nclaim_name\x18\x16 \x03(\t\x12\x12\n\nnormalized\x18\x17 \x03(\t\x12#\n\x0btx_position\x18\x18 \x01(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06\x61mount\x18\x19 \x01(\x0b\x32\x0e.pb.RangeField\x12!\n\ttimestamp\x18\x1a \x01(\x0b\x32\x0e.pb.RangeField\x12*\n\x12\x63reation_timestamp\x18\x1b \x01(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06height\x18\x1c \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0f\x63reation_height\x18\x1d \x01(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x61\x63tivation_height\x18\x1e \x01(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x65xpiration_height\x18\x1f \x01(\x0b\x32\x0e.pb.RangeField\x12$\n\x0crelease_time\x18 \x01(\x0b\x32\x0e.pb.RangeField\x12\x11\n\tshort_url\x18! \x03(\t\x12\x15\n\rcanonical_url\x18\" \x03(\t\x12\r\n\x05title\x18# \x03(\t\x12\x0e\n\x06\x61uthor\x18$ \x03(\t\x12\x13\n\x0b\x64\x65scription\x18% \x03(\t\x12\x12\n\nclaim_type\x18& \x03(\t\x12 \n\x08reposted\x18\' \x01(\x0b\x32\x0e.pb.RangeField\x12\x13\n\x0bstream_type\x18( \x03(\t\x12\x12\n\nmedia_type\x18) \x03(\t\x12\"\n\nfee_amount\x18* \x01(\x0b\x32\x0e.pb.RangeField\x12\x14\n\x0c\x66\x65\x65_currency\x18+ \x03(\t\x12 \n\x08\x64uration\x18, \x01(\x0b\x32\x0e.pb.RangeField\x12\x1b\n\x13reposted_claim_hash\x18- \x01(\t\x12#\n\x0b\x63\x65nsor_type\x18. \x01(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11\x63laims_in_channel\x18/ \x01(\t\x12$\n\x0c\x63hannel_join\x18\x30 \x01(\x0b\x32\x0e.pb.RangeField\x12\x33\n\x0fsignature_valid\x18\x31 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12(\n\x10\x65\x66\x66\x65\x63tive_amount\x18\x33 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0esupport_amount\x18\x34 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_group\x18\x35 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_mixed\x18\x36 \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_local\x18\x37 \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0ftrending_global\x18\x38 \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\nchannel_id\x18\x39 \x01(\x0b\x32\x13.pb.InvertibleField\x12(\n\x0b\x63hannel_ids\x18: \x01(\x0b\x32\x13.pb.InvertibleField\x12\r\n\x05tx_id\x18; \x03(\t\x12,\n\x07tx_nout\x18< \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x11\n\tsignature\x18= \x03(\t\x12\x18\n\x10signature_digest\x18> \x03(\t\x12\x18\n\x10public_key_bytes\x18? \x03(\t\x12\x17\n\x0fpublic_key_hash\x18@ \x03(\t\x12\x15\n\rpublic_key_id\x18\x41 \x01(\t\x12\x0b\n\x03_id\x18\x42 \x03(\x0c\x12\x10\n\x08\x61ny_tags\x18\x43 \x03(\t\x12\x10\n\x08\x61ll_tags\x18\x44 \x03(\t\x12\x10\n\x08not_tags\x18\x45 \x03(\t\x12\x19\n\x11reposted_claim_id\x18\x46 \x03(\t\x12\x39\n\x15has_channel_signature\x18G \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12.\n\nhas_source\x18H \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12=\n\x18limit_claims_per_channel\x18I \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x15\n\rany_languages\x18J \x03(\t\x12\x15\n\rall_languages\x18K \x03(\t\x12\x35\n\x11remove_duplicates\x18L \x01(\x0b\x32\x1a.google.protobuf.BoolValue21\n\x03Hub\x12*\n\x06Search\x12\x11.pb.SearchRequest\x1a\x0b.pb.Outputs\"\x00\x42&Z$github.com/lbryio/hub/protobuf/go/pbb\x06proto3'
,
dependencies=[google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR,result__pb2.DESCRIPTOR,])
@ -589,6 +589,13 @@ _SEARCHREQUEST = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='remove_duplicates', full_name='pb.SearchRequest.remove_duplicates', index=62,
number=76, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
@ -602,7 +609,7 @@ _SEARCHREQUEST = _descriptor.Descriptor(
oneofs=[
],
serialized_start=222,
serialized_end=2211,
serialized_end=2266,
)
_RANGEFIELD.fields_by_name['op'].enum_type = _RANGEFIELD_OP
@ -639,6 +646,7 @@ _SEARCHREQUEST.fields_by_name['tx_nout'].message_type = google_dot_protobuf_dot_
_SEARCHREQUEST.fields_by_name['has_channel_signature'].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE
_SEARCHREQUEST.fields_by_name['has_source'].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE
_SEARCHREQUEST.fields_by_name['limit_claims_per_channel'].message_type = google_dot_protobuf_dot_wrappers__pb2._INT32VALUE
_SEARCHREQUEST.fields_by_name['remove_duplicates'].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE
DESCRIPTOR.message_types_by_name['InvertibleField'] = _INVERTIBLEFIELD
DESCRIPTOR.message_types_by_name['RangeField'] = _RANGEFIELD
DESCRIPTOR.message_types_by_name['SearchRequest'] = _SEARCHREQUEST
@ -675,8 +683,8 @@ _HUB = _descriptor.ServiceDescriptor(
index=0,
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_start=2213,
serialized_end=2262,
serialized_start=2268,
serialized_end=2317,
methods=[
_descriptor.MethodDescriptor(
name='Search',

View file

@ -95,7 +95,7 @@ class ClaimSearchCommand(ClaimTestCase):
# f"(expected {claim['outputs'][0]['name']}) != (got {result['name']})"
# )
# @skip("okay")
@skip("okay")
async def test_basic_claim_search(self):
await self.create_channel()
channel_txo = self.channel['outputs'][0]
@ -180,7 +180,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([three], claim_id=self.get_claim_id(three))
await self.assertFindsClaims([three], claim_id=self.get_claim_id(three), text='*')
# @skip("okay")
@skip("okay")
async def test_source_filter(self):
channel = await self.channel_create('@abc')
no_source = await self.stream_create('no-source', data=None)
@ -195,7 +195,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([channel_repost, no_source_repost, normal_repost, normal, no_source, channel])
# await self.assertListsClaims([channel_repost, no_source_repost, normal_repost, normal, no_source, channel])
# @skip("Okay???")
@skip("Okay???")
async def test_pagination(self):
await self.create_channel()
await self.create_lots_of_streams()
@ -240,7 +240,7 @@ class ClaimSearchCommand(ClaimTestCase):
out_of_bounds = await self.claim_search(page=4, page_size=20, channel_id=channel_id)
self.assertEqual(out_of_bounds, [])
# @skip("okay")
@skip("okay")
async def test_tag_search(self):
claim1 = await self.stream_create('claim1', tags=['aBc'])
claim2 = await self.stream_create('claim2', tags=['#abc', 'def'])
@ -277,7 +277,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([claim3], all_tags=['abc', 'ghi'], any_tags=['jkl'], not_tags=['mno'])
await self.assertFindsClaims([claim4, claim3, claim2], all_tags=['abc'], any_tags=['def', 'ghi'])
# @skip("okay")
@skip("okay")
async def test_order_by(self):
height = self.ledger.network.remote_height
claims = [await self.stream_create(f'claim{i}') for i in range(5)]
@ -294,7 +294,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims(claims, order_by=["^name"])
# @skip("okay")
@skip("okay")
async def test_search_by_fee(self):
claim1 = await self.stream_create('claim1', fee_amount='1.0', fee_currency='lbc')
claim2 = await self.stream_create('claim2', fee_amount='0.9', fee_currency='lbc')
@ -309,7 +309,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([claim3], fee_amount='0.5', fee_currency='lbc')
await self.assertFindsClaims([claim5], fee_currency='usd')
# @skip("okay")
@skip("okay")
async def test_search_by_language(self):
claim1 = await self.stream_create('claim1', fee_amount='1.0', fee_currency='lbc')
claim2 = await self.stream_create('claim2', fee_amount='0.9', fee_currency='lbc')
@ -324,7 +324,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([claim5, claim4, claim3], any_languages=['en', 'es'])
await self.assertFindsClaims([], fee_currency='foo')
# @skip("okay")
@skip("okay")
async def test_search_by_channel(self):
match = self.assertFindsClaims
@ -380,7 +380,7 @@ class ClaimSearchCommand(ClaimTestCase):
not_channel_ids=[chan2_id], has_channel_signature=True, valid_channel_signature=True)
await match([], not_channel_ids=[chan1_id, chan2_id], has_channel_signature=True, valid_channel_signature=True)
# @skip("okay")
@skip("okay")
async def test_limit_claims_per_channel(self):
match = self.assertFindsClaims
chan1_id = self.get_claim_id(await self.channel_create('@chan1'))
@ -400,7 +400,33 @@ class ClaimSearchCommand(ClaimTestCase):
limit_claims_per_channel=3, claim_type='stream'
)
# @skip("okay")
async def test_no_duplicates(self):
await self.generate(10)
match = self.assertFindsClaims
claims = []
channels = []
first = await self.stream_create('original_claim0')
second = await self.stream_create('original_claim1')
for i in range(10):
repost_id = self.get_claim_id(second if i % 2 == 0 else first)
channel = await self.channel_create(f'@chan{i}', bid='0.001')
channels.append(channel)
claims.append(
await self.stream_repost(repost_id, f'claim{i}', bid='0.001', channel_id=self.get_claim_id(channel)))
await match([first, second] + channels,
remove_duplicates=True, order_by=['^height'])
await match(list(reversed(channels)) + [second, first],
remove_duplicates=True, order_by=['height'])
# the original claims doesn't show up, so we pick the oldest reposts
await match([channels[0], claims[0], channels[1], claims[1]] + channels[2:],
height='>218',
remove_duplicates=True, order_by=['^height'])
# limit claims per channel, invert order, oldest ones are still chosen
await match(channels[2:][::-1] + [claims[1], channels[1], claims[0], channels[0]],
height='>218', limit_claims_per_channel=1,
remove_duplicates=True, order_by=['height'])
@skip("okay")
async def test_limit_claims_per_channel_across_sorted_pages(self):
await self.generate(10)
match = self.assertFindsClaims
@ -433,7 +459,7 @@ class ClaimSearchCommand(ClaimTestCase):
limit_claims_per_channel=1, claim_type='stream', order_by=['^height']
)
# @skip("okay")
@skip("okay")
async def test_claim_type_and_media_type_search(self):
# create an invalid/unknown claim
address = await self.account.receiving.get_or_create_usable_address()
@ -476,7 +502,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([], duration='>100')
await self.assertFindsClaims([], duration='<14')
# @skip("okay")
@skip("okay")
async def test_search_by_text(self):
chan1_id = self.get_claim_id(await self.channel_create('@SatoshiNakamoto'))
chan2_id = self.get_claim_id(await self.channel_create('@Bitcoin'))