From 8252dad07d74bb97b060406e1bb9fda23a9789f4 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 14 Sep 2021 22:55:39 -0400 Subject: [PATCH 1/2] add hub.proto, remove unused fields -add trending_score to search results protobuf -remove unused trending fields from search results protobuf -update build script to use grpc_tools for python --- v2/build.sh | 10 ++++- v2/proto/claim.proto | 2 + v2/proto/hub.proto | 93 +++++++++++++++++++++++++++++++++++++++++ v2/proto/purchase.proto | 2 + v2/proto/result.proto | 8 ++-- v2/proto/support.proto | 2 + 6 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 v2/proto/hub.proto diff --git a/v2/build.sh b/v2/build.sh index efcd77f..bd549b5 100755 --- a/v2/build.sh +++ b/v2/build.sh @@ -27,7 +27,15 @@ hash protoc-gen-go 2>/dev/null || { echo >&2 'error: Make sure $GOPATH/bin is in mkdir -p $DIR/go $DIR/python $DIR/js $DIR/cpp find $DIR/go $DIR/python $DIR/js $DIR/cpp -type f -delete +$PROTOC --proto_path="$DIR/proto" \ + --go_out="$DIR/go" --go_opt=paths=source_relative \ + --go-grpc_out="$DIR/go" --go-grpc_opt=paths=source_relative \ + --js_out="import_style=commonjs,binary:$DIR/js" --cpp_out="$DIR/cpp" \ + $DIR/proto/*.proto -protoc --proto_path="$DIR/proto" --python_out="$DIR/python" --go_out="$DIR/go" --js_out="import_style=commonjs,binary:$DIR/js" --cpp_out="$DIR/cpp" $DIR/proto/*.proto +python -m grpc_tools.protoc --proto_path="$DIR/proto" \ + --python_out="$DIR/python" \ + --grpc_python_out="$DIR/python" \ + $DIR/proto/*.proto ls "$DIR"/go/*.pb.go | xargs -n1 -IX bash -c "sed -e 's/,omitempty//' X > X.tmp && mv X{.tmp,}" diff --git a/v2/proto/claim.proto b/v2/proto/claim.proto index cccb960..1b7819b 100644 --- a/v2/proto/claim.proto +++ b/v2/proto/claim.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +option go_package = "github.com/lbryio/types/go/pb"; + package pb; message Claim { diff --git a/v2/proto/hub.proto b/v2/proto/hub.proto new file mode 100644 index 0000000..c263d63 --- /dev/null +++ b/v2/proto/hub.proto @@ -0,0 +1,93 @@ +syntax = "proto3"; + +option go_package = "github.com/lbryio/types/go/pb"; +import "result.proto"; + +package pb; + +service Hub { + rpc Search (SearchRequest) returns (Outputs) {} +} + +message InvertibleField { + bool invert = 1; + repeated string value = 2; +} + +message BoolValue { + bool value = 1; +} + +message UInt32Value { + uint32 value = 1; +} + +message RangeField { + enum Op { + EQ = 0; + LTE = 1; + GTE = 2; + LT = 3; + GT = 4; + } + Op op = 1; + repeated string value = 2; +} + +message SearchRequest { + InvertibleField claim_id = 1; + InvertibleField channel_id = 2; + string text = 3; + uint32 limit = 4; + repeated string order_by = 5; + uint32 offset = 6; + bool is_controlling = 7; + string last_take_over_height = 8; + string name = 9; + string normalized_name = 10; + RangeField tx_position = 11; + RangeField amount = 12; + RangeField timestamp = 13; + RangeField creation_timestamp = 14; + RangeField height = 15; + RangeField creation_height = 16; + RangeField activation_height = 17; + RangeField expiration_height = 18; + RangeField release_time = 19; + string short_url = 20; + string canonical_url = 21; + string title = 22; + string author = 23; + string description = 24; + repeated string claim_type = 25; + RangeField repost_count = 26; + repeated string stream_type = 27; + repeated string media_type = 28; + RangeField fee_amount = 29; + string fee_currency = 30; + RangeField duration = 31; + string reposted_claim_id = 32; + RangeField censor_type = 33; + string claims_in_channel = 34; + RangeField channel_join = 35; + BoolValue is_signature_valid = 36; + RangeField effective_amount = 37; + RangeField support_amount = 38; + RangeField trending_score = 39; + string tx_id = 43; + UInt32Value tx_nout = 44; + string signature = 45; + string signature_digest = 46; + string public_key_bytes = 47; + string public_key_id = 48; + repeated string any_tags = 49; + repeated string all_tags = 50; + repeated string not_tags = 51; + bool has_channel_signature = 52; + BoolValue has_source = 53; + uint32 limit_claims_per_channel = 54; + repeated string any_languages = 55; + repeated string all_languages = 56; + bool remove_duplicates = 57; + bool no_totals = 58; +} \ No newline at end of file diff --git a/v2/proto/purchase.proto b/v2/proto/purchase.proto index f52b531..a94fc4e 100644 --- a/v2/proto/purchase.proto +++ b/v2/proto/purchase.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +option go_package = "github.com/lbryio/types/go/pb"; + package pb; message Purchase { diff --git a/v2/proto/result.proto b/v2/proto/result.proto index 8bc840a..2085a1a 100644 --- a/v2/proto/result.proto +++ b/v2/proto/result.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +option go_package = "github.com/lbryio/types/v2/go/pb"; + package pb; message Outputs { @@ -33,13 +35,9 @@ message ClaimMeta { uint32 expiration_height = 9; uint32 claims_in_channel = 10; uint32 reposted = 11; - uint64 effective_amount = 20; uint64 support_amount = 21; - uint32 trending_group = 22; - float trending_mixed = 23; - float trending_local = 24; - float trending_global = 25; + double trending_score = 22; } message Error { diff --git a/v2/proto/support.proto b/v2/proto/support.proto index 76a4c16..733988e 100644 --- a/v2/proto/support.proto +++ b/v2/proto/support.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +option go_package = "github.com/lbryio/types/go/pb"; + package pb; message Support { -- 2.45.2 From 4ae981a03139691f98c009518542cdacc785337a Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 14 Sep 2021 22:57:14 -0400 Subject: [PATCH 2/2] update built pb files --- v2/cpp/claim.pb.cc | 843 ++-- v2/cpp/claim.pb.h | 1104 ++--- v2/cpp/hub.pb.cc | 3381 +++++++++++++++ v2/cpp/hub.pb.h | 5885 ++++++++++++++++++++++++++ v2/cpp/purchase.pb.cc | 68 +- v2/cpp/purchase.pb.h | 63 +- v2/cpp/result.pb.cc | 425 +- v2/cpp/result.pb.h | 420 +- v2/cpp/support.pb.cc | 110 +- v2/cpp/support.pb.h | 130 +- v2/go/claim.pb.go | 7160 ++++++++++++++++++-------------- v2/go/hub.pb.go | 1075 +++++ v2/go/hub_grpc.pb.go | 102 + v2/go/purchase.pb.go | 173 +- v2/go/result.pb.go | 923 ++-- v2/go/support.pb.go | 181 +- v2/js/claim_pb.js | 3 + v2/js/hub_pb.js | 3164 ++++++++++++++ v2/js/purchase_pb.js | 3 + v2/js/result_pb.js | 115 +- v2/js/support_pb.js | 35 +- v2/python/claim_pb2.py | 7 +- v2/python/claim_pb2_grpc.py | 4 + v2/python/hub_pb2.py | 716 ++++ v2/python/hub_pb2_grpc.py | 67 + v2/python/purchase_pb2.py | 7 +- v2/python/purchase_pb2_grpc.py | 4 + v2/python/result_pb2.py | 46 +- v2/python/result_pb2_grpc.py | 4 + v2/python/support_pb2.py | 16 +- v2/python/support_pb2_grpc.py | 4 + 31 files changed, 20338 insertions(+), 5900 deletions(-) create mode 100644 v2/cpp/hub.pb.cc create mode 100644 v2/cpp/hub.pb.h create mode 100644 v2/go/hub.pb.go create mode 100644 v2/go/hub_grpc.pb.go create mode 100644 v2/js/hub_pb.js create mode 100644 v2/python/claim_pb2_grpc.py create mode 100644 v2/python/hub_pb2.py create mode 100644 v2/python/hub_pb2_grpc.py create mode 100644 v2/python/purchase_pb2_grpc.py create mode 100644 v2/python/result_pb2_grpc.py create mode 100644 v2/python/support_pb2_grpc.py diff --git a/v2/cpp/claim.pb.cc b/v2/cpp/claim.pb.cc index 1235c28..17bed70 100644 --- a/v2/cpp/claim.pb.cc +++ b/v2/cpp/claim.pb.cc @@ -14,279 +14,208 @@ #include // @@protoc_insertion_point(includes) #include -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Audio_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_Channel_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_ClaimList_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ClaimReference_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Fee_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Image_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Language_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Location_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Software_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Source_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<6> scc_info_Stream_claim_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_claim_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Video_claim_2eproto; + +PROTOBUF_PRAGMA_INIT_SEG namespace pb { -class ClaimDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; - const ::pb::Stream* stream_; - const ::pb::Channel* channel_; - const ::pb::ClaimList* collection_; - const ::pb::ClaimReference* repost_; -} _Claim_default_instance_; -class StreamDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; - const ::pb::Image* image_; - const ::pb::Video* video_; - const ::pb::Audio* audio_; - const ::pb::Software* software_; -} _Stream_default_instance_; -class ChannelDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Channel_default_instance_; -class ClaimReferenceDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _ClaimReference_default_instance_; -class ClaimListDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _ClaimList_default_instance_; -class SourceDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Source_default_instance_; -class FeeDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Fee_default_instance_; -class ImageDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Image_default_instance_; -class VideoDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed