Merge remote-tracking branch 'origin/master' into prometheus-and-versioning

This commit is contained in:
Jeffrey Picard 2021-09-18 13:19:47 -04:00
commit 81c3de3bfd
7 changed files with 773 additions and 417 deletions

View file

@ -1,5 +1,10 @@
FROM debian:10-slim FROM golang:alpine as stage1
EXPOSE 50051 EXPOSE 50051
COPY ./hub /hub RUN mkdir /app
WORKDIR /app
COPY . /app
RUN go build
FROM alpine:latest
COPY --from=stage1 /app/hub /hub
ENTRYPOINT ["/hub", "serve"] ENTRYPOINT ["/hub", "serve"]

49
main.go
View file

@ -18,13 +18,13 @@ import (
) )
const ( const (
defaultHost = "0.0.0.0" defaultHost = "0.0.0.0"
defaultPort = "50051" defaultPort = "50051"
defaultEsHost = "http://localhost" defaultEsHost = "http://localhost"
defaultEsPort = "9200" defaultEsIndex = "claims"
defaultEsPort = "9200"
) )
func GetEnvironment(data []string, getkeyval func(item string) (key, val string)) map[string]string { func GetEnvironment(data []string, getkeyval func(item string) (key, val string)) map[string]string {
items := make(map[string]string) items := make(map[string]string)
for _, item := range data { for _, item := range data {
@ -64,12 +64,13 @@ func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *serv
serveCmd := parser.NewCommand("serve", "start the hub server") serveCmd := parser.NewCommand("serve", "start the hub server")
searchCmd := parser.NewCommand("search", "claim search") searchCmd := parser.NewCommand("search", "claim search")
debug := parser.Flag("", "debug", &argparse.Options{Required: false, Help: "enable debug logging", Default: false})
host := parser.String("", "rpchost", &argparse.Options{Required: false, Help: "host", Default: defaultHost}) host := parser.String("", "rpchost", &argparse.Options{Required: false, Help: "RPC host", Default: defaultHost})
port := parser.String("", "rpcport", &argparse.Options{Required: false, Help: "port", Default: defaultPort}) port := parser.String("", "rpcport", &argparse.Options{Required: false, Help: "RPC port", Default: defaultPort})
esHost := parser.String("", "eshost", &argparse.Options{Required: false, Help: "host", Default: defaultEsHost}) esHost := parser.String("", "eshost", &argparse.Options{Required: false, Help: "elasticsearch host", Default: defaultEsHost})
esPort := parser.String("", "esport", &argparse.Options{Required: false, Help: "port", Default: defaultEsPort}) esPort := parser.String("", "esport", &argparse.Options{Required: false, Help: "elasticsearch port", Default: defaultEsPort})
dev := parser.Flag("", "dev", &argparse.Options{Required: false, Help: "port", Default: false}) esIndex := parser.String("", "esindex", &argparse.Options{Required: false, Help: "elasticsearch index name", Default: defaultEsIndex})
text := parser.String("", "text", &argparse.Options{Required: false, Help: "text query"}) text := parser.String("", "text", &argparse.Options{Required: false, Help: "text query"})
name := parser.String("", "name", &argparse.Options{Required: false, Help: "name"}) name := parser.String("", "name", &argparse.Options{Required: false, Help: "name"})
@ -89,14 +90,14 @@ func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *serv
log.Fatalln(parser.Usage(err)) log.Fatalln(parser.Usage(err))
} }
args := &server.Args{ args := &server.Args{
CmdType: server.SearchCmd, CmdType: server.SearchCmd,
Host: *host, Host: *host,
Port: ":" + *port, Port: ":" + *port,
EsHost: *esHost, EsHost: *esHost,
EsPort: *esPort, EsPort: *esPort,
Dev: *dev, EsIndex: *esIndex,
Debug: *debug,
} }
if esHost, ok := environment["ELASTIC_HOST"]; ok { if esHost, ok := environment["ELASTIC_HOST"]; ok {
@ -112,8 +113,8 @@ func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *serv
} }
/* /*
Verify no invalid argument combinations Verify no invalid argument combinations
*/ */
if len(*channelIds) > 0 && *channelId != "" { if len(*channelIds) > 0 && *channelId != "" {
log.Fatal("Cannot specify both channel_id and channel_ids") log.Fatal("Cannot specify both channel_id and channel_ids")
} }
@ -127,23 +128,23 @@ func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *serv
if *text != "" { if *text != "" {
searchRequest.Text = *text searchRequest.Text = *text
} }
if *name!= "" { if *name != "" {
searchRequest.Name = []string{*name} searchRequest.ClaimName = *name
} }
if *claimType != "" { if *claimType != "" {
searchRequest.ClaimType = []string{*claimType} searchRequest.ClaimType = []string{*claimType}
} }
if *id != "" { if *id != "" {
searchRequest.XId = [][]byte{[]byte(*id)} searchRequest.ClaimId = &pb.InvertibleField{Invert: false, Value: []string{*id}}
} }
if *author != "" { if *author != "" {
searchRequest.Author = []string{*author} searchRequest.Author = *author
} }
if *title != "" { if *title != "" {
searchRequest.Title = []string{*title} searchRequest.Title = *title
} }
if *description != "" { if *description != "" {
searchRequest.Description = []string{*description} searchRequest.Description = *description
} }
if *channelId != "" { if *channelId != "" {
searchRequest.ChannelId = &pb.InvertibleField{Invert: false, Value: []string{*channelId}} searchRequest.ChannelId = &pb.InvertibleField{Invert: false, Value: []string{*channelId}}

View file

@ -1,7 +1,6 @@
syntax = "proto3"; syntax = "proto3";
option go_package = "github.com/lbryio/hub/protobuf/go/pb"; option go_package = "github.com/lbryio/hub/protobuf/go/pb";
import "google/protobuf/wrappers.proto";
import "result.proto"; import "result.proto";
package pb; package pb;
@ -26,6 +25,14 @@ message InvertibleField {
repeated string value = 2; repeated string value = 2;
} }
message BoolValue {
bool value = 1;
}
message UInt32Value {
uint32 value = 1;
}
message RangeField { message RangeField {
enum Op { enum Op {
EQ = 0; EQ = 0;
@ -39,74 +46,62 @@ message RangeField {
} }
message SearchRequest { message SearchRequest {
string text = 1; InvertibleField claim_id = 1;
repeated string name = 2; InvertibleField channel_id = 2;
.google.protobuf.Int32Value amount_order = 3; string text = 3;
.google.protobuf.Int32Value limit = 4; uint32 limit = 4;
repeated string order_by = 5; repeated string order_by = 5;
.google.protobuf.Int32Value offset = 6; uint32 offset = 6;
.google.protobuf.BoolValue is_controlling = 7; bool is_controlling = 7;
string last_take_over_height = 19; string last_take_over_height = 8;
InvertibleField claim_id = 20; string claim_name = 9;
repeated string claim_name = 22; string normalized_name = 10;
repeated string normalized_name = 23; RangeField tx_position = 11;
RangeField tx_position = 24; RangeField amount = 12;
RangeField amount = 25; RangeField timestamp = 13;
RangeField timestamp = 26; RangeField creation_timestamp = 14;
RangeField creation_timestamp = 27; RangeField height = 15;
RangeField height = 28; RangeField creation_height = 16;
RangeField creation_height = 29; RangeField activation_height = 17;
RangeField activation_height = 30; RangeField expiration_height = 18;
RangeField expiration_height = 31; RangeField release_time = 19;
RangeField release_time = 32; string short_url = 20;
repeated string short_url = 33; string canonical_url = 21;
repeated string canonical_url = 34; string title = 22;
repeated string title = 35; string author = 23;
repeated string author = 36; string description = 24;
repeated string description = 37; repeated string claim_type = 25;
repeated string claim_type = 38; RangeField repost_count = 26;
RangeField repost_count = 39; repeated string stream_type = 27;
repeated string stream_type = 40; repeated string media_type = 28;
repeated string media_type = 41; RangeField fee_amount = 29;
RangeField fee_amount = 42; string fee_currency = 30;
repeated string fee_currency = 43; RangeField duration = 31;
RangeField duration = 44; string reposted_claim_id = 32;
string reposted_claim_hash = 45; RangeField censor_type = 33;
RangeField censor_type = 46; string claims_in_channel = 34;
string claims_in_channel = 47; RangeField channel_join = 35;
RangeField channel_join = 48; BoolValue is_signature_valid = 36;
.google.protobuf.BoolValue is_signature_valid = 49; RangeField effective_amount = 37;
RangeField effective_amount = 51; RangeField support_amount = 38;
RangeField support_amount = 52; RangeField trending_group = 39;
RangeField trending_group = 53; RangeField trending_mixed = 40;
RangeField trending_mixed = 54; RangeField trending_local = 41;
RangeField trending_local = 55; RangeField trending_global = 42;
RangeField trending_global = 56; string tx_id = 43;
InvertibleField channel_id = 57; UInt32Value tx_nout = 44;
InvertibleField channel_ids = 58; string signature = 45;
repeated string tx_id = 59; string signature_digest = 46;
.google.protobuf.Int32Value tx_nout = 60; string public_key_bytes = 47;
repeated string signature = 61; string public_key_id = 48;
repeated string signature_digest = 62; repeated string any_tags = 49;
repeated string public_key_bytes = 63; repeated string all_tags = 50;
// repeated string public_key_hash = 64; repeated string not_tags = 51;
string public_key_id = 65; bool has_channel_signature = 52;
repeated bytes _id = 66; BoolValue has_source = 53;
repeated string any_tags = 67; uint32 limit_claims_per_channel = 54;
repeated string all_tags = 68; repeated string any_languages = 55;
repeated string not_tags = 69; repeated string all_languages = 56;
repeated string reposted_claim_id = 70; bool remove_duplicates = 57;
.google.protobuf.BoolValue has_channel_signature = 71; bool no_totals = 58;
.google.protobuf.BoolValue has_source = 72;
.google.protobuf.Int32Value limit_claims_per_channel = 73;
repeated string any_languages = 74;
repeated string all_languages = 75;
.google.protobuf.BoolValue remove_duplicates = 76;
.google.protobuf.BoolValue no_totals = 77;
repeated string search_indices = 78;
}
message BlockRequest {
string blockhash = 1;
bool verbose = 2;
} }

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.26.0 // protoc-gen-go v1.26.0
// protoc v3.17.1 // protoc v3.17.3
// source: hub.proto // source: hub.proto
package pb package pb
@ -9,7 +9,6 @@ package pb
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
) )
@ -73,6 +72,7 @@ func (x RangeField_Op) Number() protoreflect.EnumNumber {
// Deprecated: Use RangeField_Op.Descriptor instead. // Deprecated: Use RangeField_Op.Descriptor instead.
func (RangeField_Op) EnumDescriptor() ([]byte, []int) { func (RangeField_Op) EnumDescriptor() ([]byte, []int) {
<<<<<<< HEAD
return file_hub_proto_rawDescGZIP(), []int{2, 0} return file_hub_proto_rawDescGZIP(), []int{2, 0}
} }
@ -112,6 +112,9 @@ func (x *EmptyMessage) ProtoReflect() protoreflect.Message {
// Deprecated: Use EmptyMessage.ProtoReflect.Descriptor instead. // Deprecated: Use EmptyMessage.ProtoReflect.Descriptor instead.
func (*EmptyMessage) Descriptor() ([]byte, []int) { func (*EmptyMessage) Descriptor() ([]byte, []int) {
return file_hub_proto_rawDescGZIP(), []int{0} return file_hub_proto_rawDescGZIP(), []int{0}
=======
return file_hub_proto_rawDescGZIP(), []int{3, 0}
>>>>>>> origin/master
} }
type InvertibleField struct { type InvertibleField struct {
@ -169,6 +172,100 @@ func (x *InvertibleField) GetValue() []string {
return nil return nil
} }
type BoolValue struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value"`
}
func (x *BoolValue) Reset() {
*x = BoolValue{}
if protoimpl.UnsafeEnabled {
mi := &file_hub_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BoolValue) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BoolValue) ProtoMessage() {}
func (x *BoolValue) ProtoReflect() protoreflect.Message {
mi := &file_hub_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BoolValue.ProtoReflect.Descriptor instead.
func (*BoolValue) Descriptor() ([]byte, []int) {
return file_hub_proto_rawDescGZIP(), []int{1}
}
func (x *BoolValue) GetValue() bool {
if x != nil {
return x.Value
}
return false
}
type UInt32Value struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value"`
}
func (x *UInt32Value) Reset() {
*x = UInt32Value{}
if protoimpl.UnsafeEnabled {
mi := &file_hub_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UInt32Value) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UInt32Value) ProtoMessage() {}
func (x *UInt32Value) ProtoReflect() protoreflect.Message {
mi := &file_hub_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UInt32Value.ProtoReflect.Descriptor instead.
func (*UInt32Value) Descriptor() ([]byte, []int) {
return file_hub_proto_rawDescGZIP(), []int{2}
}
func (x *UInt32Value) GetValue() uint32 {
if x != nil {
return x.Value
}
return 0
}
type RangeField struct { type RangeField struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -181,7 +278,11 @@ type RangeField struct {
func (x *RangeField) Reset() { func (x *RangeField) Reset() {
*x = RangeField{} *x = RangeField{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
<<<<<<< HEAD
mi := &file_hub_proto_msgTypes[2] mi := &file_hub_proto_msgTypes[2]
=======
mi := &file_hub_proto_msgTypes[3]
>>>>>>> origin/master
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -194,7 +295,11 @@ func (x *RangeField) String() string {
func (*RangeField) ProtoMessage() {} func (*RangeField) ProtoMessage() {}
func (x *RangeField) ProtoReflect() protoreflect.Message { func (x *RangeField) ProtoReflect() protoreflect.Message {
<<<<<<< HEAD
mi := &file_hub_proto_msgTypes[2] mi := &file_hub_proto_msgTypes[2]
=======
mi := &file_hub_proto_msgTypes[3]
>>>>>>> origin/master
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -207,7 +312,11 @@ func (x *RangeField) ProtoReflect() protoreflect.Message {
// Deprecated: Use RangeField.ProtoReflect.Descriptor instead. // Deprecated: Use RangeField.ProtoReflect.Descriptor instead.
func (*RangeField) Descriptor() ([]byte, []int) { func (*RangeField) Descriptor() ([]byte, []int) {
<<<<<<< HEAD
return file_hub_proto_rawDescGZIP(), []int{2} return file_hub_proto_rawDescGZIP(), []int{2}
=======
return file_hub_proto_rawDescGZIP(), []int{3}
>>>>>>> origin/master
} }
func (x *RangeField) GetOp() RangeField_Op { func (x *RangeField) GetOp() RangeField_Op {
@ -229,6 +338,7 @@ type SearchRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
<<<<<<< HEAD
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text"` Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text"`
Name []string `protobuf:"bytes,2,rep,name=name,proto3" json:"name"` Name []string `protobuf:"bytes,2,rep,name=name,proto3" json:"name"`
AmountOrder *wrapperspb.Int32Value `protobuf:"bytes,3,opt,name=amount_order,json=amountOrder,proto3" json:"amount_order"` AmountOrder *wrapperspb.Int32Value `protobuf:"bytes,3,opt,name=amount_order,json=amountOrder,proto3" json:"amount_order"`
@ -294,12 +404,76 @@ type SearchRequest struct {
RemoveDuplicates *wrapperspb.BoolValue `protobuf:"bytes,76,opt,name=remove_duplicates,json=removeDuplicates,proto3" json:"remove_duplicates"` RemoveDuplicates *wrapperspb.BoolValue `protobuf:"bytes,76,opt,name=remove_duplicates,json=removeDuplicates,proto3" json:"remove_duplicates"`
NoTotals *wrapperspb.BoolValue `protobuf:"bytes,77,opt,name=no_totals,json=noTotals,proto3" json:"no_totals"` NoTotals *wrapperspb.BoolValue `protobuf:"bytes,77,opt,name=no_totals,json=noTotals,proto3" json:"no_totals"`
SearchIndices []string `protobuf:"bytes,78,rep,name=search_indices,json=searchIndices,proto3" json:"search_indices"` SearchIndices []string `protobuf:"bytes,78,rep,name=search_indices,json=searchIndices,proto3" json:"search_indices"`
=======
ClaimId *InvertibleField `protobuf:"bytes,1,opt,name=claim_id,json=claimId,proto3" json:"claim_id"`
ChannelId *InvertibleField `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id"`
Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text"`
Limit uint32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit"`
OrderBy []string `protobuf:"bytes,5,rep,name=order_by,json=orderBy,proto3" json:"order_by"`
Offset uint32 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset"`
IsControlling bool `protobuf:"varint,7,opt,name=is_controlling,json=isControlling,proto3" json:"is_controlling"`
LastTakeOverHeight string `protobuf:"bytes,8,opt,name=last_take_over_height,json=lastTakeOverHeight,proto3" json:"last_take_over_height"`
ClaimName string `protobuf:"bytes,9,opt,name=claim_name,json=claimName,proto3" json:"claim_name"`
NormalizedName string `protobuf:"bytes,10,opt,name=normalized_name,json=normalizedName,proto3" json:"normalized_name"`
TxPosition *RangeField `protobuf:"bytes,11,opt,name=tx_position,json=txPosition,proto3" json:"tx_position"`
Amount *RangeField `protobuf:"bytes,12,opt,name=amount,proto3" json:"amount"`
Timestamp *RangeField `protobuf:"bytes,13,opt,name=timestamp,proto3" json:"timestamp"`
CreationTimestamp *RangeField `protobuf:"bytes,14,opt,name=creation_timestamp,json=creationTimestamp,proto3" json:"creation_timestamp"`
Height *RangeField `protobuf:"bytes,15,opt,name=height,proto3" json:"height"`
CreationHeight *RangeField `protobuf:"bytes,16,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height"`
ActivationHeight *RangeField `protobuf:"bytes,17,opt,name=activation_height,json=activationHeight,proto3" json:"activation_height"`
ExpirationHeight *RangeField `protobuf:"bytes,18,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height"`
ReleaseTime *RangeField `protobuf:"bytes,19,opt,name=release_time,json=releaseTime,proto3" json:"release_time"`
ShortUrl string `protobuf:"bytes,20,opt,name=short_url,json=shortUrl,proto3" json:"short_url"`
CanonicalUrl string `protobuf:"bytes,21,opt,name=canonical_url,json=canonicalUrl,proto3" json:"canonical_url"`
Title string `protobuf:"bytes,22,opt,name=title,proto3" json:"title"`
Author string `protobuf:"bytes,23,opt,name=author,proto3" json:"author"`
Description string `protobuf:"bytes,24,opt,name=description,proto3" json:"description"`
ClaimType []string `protobuf:"bytes,25,rep,name=claim_type,json=claimType,proto3" json:"claim_type"`
RepostCount *RangeField `protobuf:"bytes,26,opt,name=repost_count,json=repostCount,proto3" json:"repost_count"`
StreamType []string `protobuf:"bytes,27,rep,name=stream_type,json=streamType,proto3" json:"stream_type"`
MediaType []string `protobuf:"bytes,28,rep,name=media_type,json=mediaType,proto3" json:"media_type"`
FeeAmount *RangeField `protobuf:"bytes,29,opt,name=fee_amount,json=feeAmount,proto3" json:"fee_amount"`
FeeCurrency string `protobuf:"bytes,30,opt,name=fee_currency,json=feeCurrency,proto3" json:"fee_currency"`
Duration *RangeField `protobuf:"bytes,31,opt,name=duration,proto3" json:"duration"`
RepostedClaimId string `protobuf:"bytes,32,opt,name=reposted_claim_id,json=repostedClaimId,proto3" json:"reposted_claim_id"`
CensorType *RangeField `protobuf:"bytes,33,opt,name=censor_type,json=censorType,proto3" json:"censor_type"`
ClaimsInChannel string `protobuf:"bytes,34,opt,name=claims_in_channel,json=claimsInChannel,proto3" json:"claims_in_channel"`
ChannelJoin *RangeField `protobuf:"bytes,35,opt,name=channel_join,json=channelJoin,proto3" json:"channel_join"`
IsSignatureValid *BoolValue `protobuf:"bytes,36,opt,name=is_signature_valid,json=isSignatureValid,proto3" json:"is_signature_valid"`
EffectiveAmount *RangeField `protobuf:"bytes,37,opt,name=effective_amount,json=effectiveAmount,proto3" json:"effective_amount"`
SupportAmount *RangeField `protobuf:"bytes,38,opt,name=support_amount,json=supportAmount,proto3" json:"support_amount"`
TrendingGroup *RangeField `protobuf:"bytes,39,opt,name=trending_group,json=trendingGroup,proto3" json:"trending_group"`
TrendingMixed *RangeField `protobuf:"bytes,40,opt,name=trending_mixed,json=trendingMixed,proto3" json:"trending_mixed"`
TrendingLocal *RangeField `protobuf:"bytes,41,opt,name=trending_local,json=trendingLocal,proto3" json:"trending_local"`
TrendingGlobal *RangeField `protobuf:"bytes,42,opt,name=trending_global,json=trendingGlobal,proto3" json:"trending_global"`
TxId string `protobuf:"bytes,43,opt,name=tx_id,json=txId,proto3" json:"tx_id"`
TxNout *UInt32Value `protobuf:"bytes,44,opt,name=tx_nout,json=txNout,proto3" json:"tx_nout"`
Signature string `protobuf:"bytes,45,opt,name=signature,proto3" json:"signature"`
SignatureDigest string `protobuf:"bytes,46,opt,name=signature_digest,json=signatureDigest,proto3" json:"signature_digest"`
PublicKeyBytes string `protobuf:"bytes,47,opt,name=public_key_bytes,json=publicKeyBytes,proto3" json:"public_key_bytes"`
PublicKeyId string `protobuf:"bytes,48,opt,name=public_key_id,json=publicKeyId,proto3" json:"public_key_id"`
AnyTags []string `protobuf:"bytes,49,rep,name=any_tags,json=anyTags,proto3" json:"any_tags"`
AllTags []string `protobuf:"bytes,50,rep,name=all_tags,json=allTags,proto3" json:"all_tags"`
NotTags []string `protobuf:"bytes,51,rep,name=not_tags,json=notTags,proto3" json:"not_tags"`
HasChannelSignature bool `protobuf:"varint,52,opt,name=has_channel_signature,json=hasChannelSignature,proto3" json:"has_channel_signature"`
HasSource *BoolValue `protobuf:"bytes,53,opt,name=has_source,json=hasSource,proto3" json:"has_source"`
LimitClaimsPerChannel uint32 `protobuf:"varint,54,opt,name=limit_claims_per_channel,json=limitClaimsPerChannel,proto3" json:"limit_claims_per_channel"`
AnyLanguages []string `protobuf:"bytes,55,rep,name=any_languages,json=anyLanguages,proto3" json:"any_languages"`
AllLanguages []string `protobuf:"bytes,56,rep,name=all_languages,json=allLanguages,proto3" json:"all_languages"`
RemoveDuplicates bool `protobuf:"varint,57,opt,name=remove_duplicates,json=removeDuplicates,proto3" json:"remove_duplicates"`
NoTotals bool `protobuf:"varint,58,opt,name=no_totals,json=noTotals,proto3" json:"no_totals"`
>>>>>>> origin/master
} }
func (x *SearchRequest) Reset() { func (x *SearchRequest) Reset() {
*x = SearchRequest{} *x = SearchRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
<<<<<<< HEAD
mi := &file_hub_proto_msgTypes[3] mi := &file_hub_proto_msgTypes[3]
=======
mi := &file_hub_proto_msgTypes[4]
>>>>>>> origin/master
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -312,7 +486,11 @@ func (x *SearchRequest) String() string {
func (*SearchRequest) ProtoMessage() {} func (*SearchRequest) ProtoMessage() {}
func (x *SearchRequest) ProtoReflect() protoreflect.Message { func (x *SearchRequest) ProtoReflect() protoreflect.Message {
<<<<<<< HEAD
mi := &file_hub_proto_msgTypes[3] mi := &file_hub_proto_msgTypes[3]
=======
mi := &file_hub_proto_msgTypes[4]
>>>>>>> origin/master
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -325,63 +503,11 @@ func (x *SearchRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
func (*SearchRequest) Descriptor() ([]byte, []int) { func (*SearchRequest) Descriptor() ([]byte, []int) {
<<<<<<< HEAD
return file_hub_proto_rawDescGZIP(), []int{3} return file_hub_proto_rawDescGZIP(), []int{3}
} =======
return file_hub_proto_rawDescGZIP(), []int{4}
func (x *SearchRequest) GetText() string { >>>>>>> origin/master
if x != nil {
return x.Text
}
return ""
}
func (x *SearchRequest) GetName() []string {
if x != nil {
return x.Name
}
return nil
}
func (x *SearchRequest) GetAmountOrder() *wrapperspb.Int32Value {
if x != nil {
return x.AmountOrder
}
return nil
}
func (x *SearchRequest) GetLimit() *wrapperspb.Int32Value {
if x != nil {
return x.Limit
}
return nil
}
func (x *SearchRequest) GetOrderBy() []string {
if x != nil {
return x.OrderBy
}
return nil
}
func (x *SearchRequest) GetOffset() *wrapperspb.Int32Value {
if x != nil {
return x.Offset
}
return nil
}
func (x *SearchRequest) GetIsControlling() *wrapperspb.BoolValue {
if x != nil {
return x.IsControlling
}
return nil
}
func (x *SearchRequest) GetLastTakeOverHeight() string {
if x != nil {
return x.LastTakeOverHeight
}
return ""
} }
func (x *SearchRequest) GetClaimId() *InvertibleField { func (x *SearchRequest) GetClaimId() *InvertibleField {
@ -391,18 +517,71 @@ func (x *SearchRequest) GetClaimId() *InvertibleField {
return nil return nil
} }
func (x *SearchRequest) GetClaimName() []string { func (x *SearchRequest) GetChannelId() *InvertibleField {
if x != nil { if x != nil {
return x.ClaimName return x.ChannelId
} }
return nil return nil
} }
func (x *SearchRequest) GetText() string {
if x != nil {
return x.Text
}
return ""
}
func (x *SearchRequest) GetLimit() uint32 {
if x != nil {
return x.Limit
}
return 0
}
func (x *SearchRequest) GetOrderBy() []string {
if x != nil {
return x.OrderBy
}
return nil
}
func (x *SearchRequest) GetOffset() uint32 {
if x != nil {
return x.Offset
}
return 0
}
func (x *SearchRequest) GetIsControlling() bool {
if x != nil {
return x.IsControlling
}
return false
}
func (x *SearchRequest) GetLastTakeOverHeight() string {
if x != nil {
return x.LastTakeOverHeight
}
return ""
}
func (x *SearchRequest) GetClaimName() string {
if x != nil {
return x.ClaimName
}
return ""
}
<<<<<<< HEAD
func (x *SearchRequest) GetNormalizedName() []string { func (x *SearchRequest) GetNormalizedName() []string {
=======
func (x *SearchRequest) GetNormalizedName() string {
>>>>>>> origin/master
if x != nil { if x != nil {
return x.NormalizedName return x.NormalizedName
} }
return nil return ""
} }
func (x *SearchRequest) GetTxPosition() *RangeField { func (x *SearchRequest) GetTxPosition() *RangeField {
@ -468,39 +647,39 @@ func (x *SearchRequest) GetReleaseTime() *RangeField {
return nil return nil
} }
func (x *SearchRequest) GetShortUrl() []string { func (x *SearchRequest) GetShortUrl() string {
if x != nil { if x != nil {
return x.ShortUrl return x.ShortUrl
} }
return nil return ""
} }
func (x *SearchRequest) GetCanonicalUrl() []string { func (x *SearchRequest) GetCanonicalUrl() string {
if x != nil { if x != nil {
return x.CanonicalUrl return x.CanonicalUrl
} }
return nil return ""
} }
func (x *SearchRequest) GetTitle() []string { func (x *SearchRequest) GetTitle() string {
if x != nil { if x != nil {
return x.Title return x.Title
} }
return nil return ""
} }
func (x *SearchRequest) GetAuthor() []string { func (x *SearchRequest) GetAuthor() string {
if x != nil { if x != nil {
return x.Author return x.Author
} }
return nil return ""
} }
func (x *SearchRequest) GetDescription() []string { func (x *SearchRequest) GetDescription() string {
if x != nil { if x != nil {
return x.Description return x.Description
} }
return nil return ""
} }
func (x *SearchRequest) GetClaimType() []string { func (x *SearchRequest) GetClaimType() []string {
@ -538,11 +717,11 @@ func (x *SearchRequest) GetFeeAmount() *RangeField {
return nil return nil
} }
func (x *SearchRequest) GetFeeCurrency() []string { func (x *SearchRequest) GetFeeCurrency() string {
if x != nil { if x != nil {
return x.FeeCurrency return x.FeeCurrency
} }
return nil return ""
} }
func (x *SearchRequest) GetDuration() *RangeField { func (x *SearchRequest) GetDuration() *RangeField {
@ -552,9 +731,9 @@ func (x *SearchRequest) GetDuration() *RangeField {
return nil return nil
} }
func (x *SearchRequest) GetRepostedClaimHash() string { func (x *SearchRequest) GetRepostedClaimId() string {
if x != nil { if x != nil {
return x.RepostedClaimHash return x.RepostedClaimId
} }
return "" return ""
} }
@ -580,7 +759,11 @@ func (x *SearchRequest) GetChannelJoin() *RangeField {
return nil return nil
} }
<<<<<<< HEAD
func (x *SearchRequest) GetIsSignatureValid() *wrapperspb.BoolValue { func (x *SearchRequest) GetIsSignatureValid() *wrapperspb.BoolValue {
=======
func (x *SearchRequest) GetIsSignatureValid() *BoolValue {
>>>>>>> origin/master
if x != nil { if x != nil {
return x.IsSignatureValid return x.IsSignatureValid
} }
@ -629,53 +812,43 @@ func (x *SearchRequest) GetTrendingGlobal() *RangeField {
return nil return nil
} }
func (x *SearchRequest) GetChannelId() *InvertibleField { func (x *SearchRequest) GetTxId() string {
if x != nil {
return x.ChannelId
}
return nil
}
func (x *SearchRequest) GetChannelIds() *InvertibleField {
if x != nil {
return x.ChannelIds
}
return nil
}
func (x *SearchRequest) GetTxId() []string {
if x != nil { if x != nil {
return x.TxId return x.TxId
} }
return nil return ""
} }
func (x *SearchRequest) GetTxNout() *wrapperspb.Int32Value { func (x *SearchRequest) GetTxNout() *UInt32Value {
if x != nil { if x != nil {
return x.TxNout return x.TxNout
} }
return nil return nil
} }
func (x *SearchRequest) GetSignature() []string { func (x *SearchRequest) GetSignature() string {
if x != nil { if x != nil {
return x.Signature return x.Signature
} }
return nil return ""
} }
func (x *SearchRequest) GetSignatureDigest() []string { func (x *SearchRequest) GetSignatureDigest() string {
if x != nil { if x != nil {
return x.SignatureDigest return x.SignatureDigest
} }
return nil return ""
} }
func (x *SearchRequest) GetPublicKeyBytes() []string { func (x *SearchRequest) GetPublicKeyBytes() string {
if x != nil { if x != nil {
return x.PublicKeyBytes return x.PublicKeyBytes
} }
<<<<<<< HEAD
return nil return nil
=======
return ""
>>>>>>> origin/master
} }
func (x *SearchRequest) GetPublicKeyId() string { func (x *SearchRequest) GetPublicKeyId() string {
@ -685,13 +858,6 @@ func (x *SearchRequest) GetPublicKeyId() string {
return "" return ""
} }
func (x *SearchRequest) GetXId() [][]byte {
if x != nil {
return x.XId
}
return nil
}
func (x *SearchRequest) GetAnyTags() []string { func (x *SearchRequest) GetAnyTags() []string {
if x != nil { if x != nil {
return x.AnyTags return x.AnyTags
@ -713,32 +879,25 @@ func (x *SearchRequest) GetNotTags() []string {
return nil return nil
} }
func (x *SearchRequest) GetRepostedClaimId() []string { func (x *SearchRequest) GetHasChannelSignature() bool {
if x != nil {
return x.RepostedClaimId
}
return nil
}
func (x *SearchRequest) GetHasChannelSignature() *wrapperspb.BoolValue {
if x != nil { if x != nil {
return x.HasChannelSignature return x.HasChannelSignature
} }
return nil return false
} }
func (x *SearchRequest) GetHasSource() *wrapperspb.BoolValue { func (x *SearchRequest) GetHasSource() *BoolValue {
if x != nil { if x != nil {
return x.HasSource return x.HasSource
} }
return nil return nil
} }
func (x *SearchRequest) GetLimitClaimsPerChannel() *wrapperspb.Int32Value { func (x *SearchRequest) GetLimitClaimsPerChannel() uint32 {
if x != nil { if x != nil {
return x.LimitClaimsPerChannel return x.LimitClaimsPerChannel
} }
return nil return 0
} }
func (x *SearchRequest) GetAnyLanguages() []string { func (x *SearchRequest) GetAnyLanguages() []string {
@ -755,25 +914,18 @@ func (x *SearchRequest) GetAllLanguages() []string {
return nil return nil
} }
func (x *SearchRequest) GetRemoveDuplicates() *wrapperspb.BoolValue { func (x *SearchRequest) GetRemoveDuplicates() bool {
if x != nil { if x != nil {
return x.RemoveDuplicates return x.RemoveDuplicates
} }
return nil return false
} }
func (x *SearchRequest) GetNoTotals() *wrapperspb.BoolValue { func (x *SearchRequest) GetNoTotals() bool {
if x != nil { if x != nil {
return x.NoTotals return x.NoTotals
} }
return nil return false
}
func (x *SearchRequest) GetSearchIndices() []string {
if x != nil {
return x.SearchIndices
}
return nil
} }
type BlockRequest struct { type BlockRequest struct {
@ -835,6 +987,7 @@ var File_hub_proto protoreflect.FileDescriptor
var file_hub_proto_rawDesc = []byte{ var file_hub_proto_rawDesc = []byte{
0x0a, 0x09, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x0a, 0x09, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a,
<<<<<<< HEAD
0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x0c, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a,
@ -1078,6 +1231,184 @@ var file_hub_proto_rawDesc = []byte{
0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x62, 0x72, 0x79, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x62, 0x72, 0x79,
0x69, 0x6f, 0x2f, 0x68, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x69, 0x6f, 0x2f, 0x68, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,
0x67, 0x6f, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x67, 0x6f, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
=======
0x0c, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a,
0x0f, 0x49, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x69, 0x62, 0x6c, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x21,
0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x22, 0x23, 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x75, 0x0a, 0x0a, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46,
0x69, 0x65, 0x6c, 0x64, 0x12, 0x21, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64,
0x2e, 0x4f, 0x70, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2e, 0x0a,
0x02, 0x4f, 0x70, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4c,
0x54, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x54, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a,
0x02, 0x4c, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x04, 0x22, 0x87, 0x13,
0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x2e, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x69, 0x62, 0x6c,
0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x49, 0x64, 0x12,
0x32, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x69,
0x62, 0x6c, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65,
0x6c, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x19, 0x0a,
0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52,
0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73,
0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x12, 0x25, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x69,
0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x74,
0x72, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x31, 0x0a, 0x15, 0x6c, 0x61, 0x73, 0x74, 0x5f,
0x74, 0x61, 0x6b, 0x65, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74,
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x61, 0x6b, 0x65,
0x4f, 0x76, 0x65, 0x72, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c,
0x61, 0x69, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x63, 0x6c, 0x61, 0x69, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6e, 0x6f, 0x72,
0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0e, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0b, 0x74, 0x78, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e,
0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0a, 0x74, 0x78, 0x50, 0x6f, 0x73, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69,
0x65, 0x6c, 0x64, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x09, 0x74,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x09,
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x3d, 0x0a, 0x12, 0x63, 0x72, 0x65,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18,
0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65,
0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67,
0x68, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61,
0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74,
0x12, 0x37, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69,
0x67, 0x68, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52,
0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x3b, 0x0a, 0x11, 0x61, 0x63, 0x74,
0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x11,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46,
0x69, 0x65, 0x6c, 0x64, 0x52, 0x10, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x3b, 0x0a, 0x11, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c,
0x64, 0x52, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x69,
0x67, 0x68, 0x74, 0x12, 0x31, 0x0a, 0x0c, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52,
0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61,
0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f,
0x75, 0x72, 0x6c, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74,
0x55, 0x72, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c,
0x5f, 0x75, 0x72, 0x6c, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x6e, 0x6f,
0x6e, 0x69, 0x63, 0x61, 0x6c, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c,
0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x17, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x61, 0x69,
0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x19, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c,
0x61, 0x69, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73,
0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0b, 0x72,
0x65, 0x70, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x09, 0x52,
0x0a, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d,
0x65, 0x64, 0x69, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x1c, 0x20, 0x03, 0x28, 0x09, 0x52,
0x09, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x0a, 0x66, 0x65,
0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x09,
0x66, 0x65, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x65, 0x65,
0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0b, 0x66, 0x65, 0x65, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2a, 0x0a, 0x08,
0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x08,
0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x72, 0x65, 0x70, 0x6f,
0x73, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x20, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x61,
0x69, 0x6d, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0b, 0x63, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x5f, 0x74,
0x79, 0x70, 0x65, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52,
0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0a, 0x63, 0x65, 0x6e, 0x73, 0x6f,
0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x5f,
0x69, 0x6e, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x49, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65,
0x6c, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x6a, 0x6f, 0x69,
0x6e, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e,
0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c,
0x4a, 0x6f, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x12, 0x69, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61,
0x74, 0x75, 0x72, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,
0x10, 0x69, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x61, 0x6c, 0x69,
0x64, 0x12, 0x39, 0x0a, 0x10, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x25, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62,
0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0f, 0x65, 0x66, 0x66,
0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x0e,
0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x26,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46,
0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x6d, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f,
0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62,
0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x74, 0x72, 0x65,
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x0a, 0x0e, 0x74, 0x72,
0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x18, 0x28, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65,
0x6c, 0x64, 0x52, 0x0d, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x69, 0x78, 0x65,
0x64, 0x12, 0x35, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x6f,
0x63, 0x61, 0x6c, 0x18, 0x29, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52,
0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x74, 0x72, 0x65, 0x6e, 0x64,
0x69, 0x6e, 0x67, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x0f, 0x74, 0x72, 0x65, 0x6e,
0x64, 0x69, 0x6e, 0x67, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x18, 0x2a, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c,
0x64, 0x52, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x47, 0x6c, 0x6f, 0x62, 0x61,
0x6c, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x74, 0x78, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x6e, 0x6f, 0x75,
0x74, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x49, 0x6e,
0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x74, 0x78, 0x4e, 0x6f, 0x75, 0x74,
0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x2d, 0x20,
0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29,
0x0a, 0x10, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x69, 0x67, 0x65,
0x73, 0x74, 0x18, 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
0x75, 0x72, 0x65, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x75, 0x62,
0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x2f, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x79,
0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65,
0x79, 0x5f, 0x69, 0x64, 0x18, 0x30, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c,
0x69, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x6e, 0x79, 0x5f, 0x74,
0x61, 0x67, 0x73, 0x18, 0x31, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6e, 0x79, 0x54, 0x61,
0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x32,
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6c, 0x6c, 0x54, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a,
0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x33, 0x20, 0x03, 0x28, 0x09, 0x52,
0x07, 0x6e, 0x6f, 0x74, 0x54, 0x61, 0x67, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x68, 0x61, 0x73, 0x5f,
0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72,
0x65, 0x18, 0x34, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x68, 0x61, 0x73, 0x43, 0x68, 0x61, 0x6e,
0x6e, 0x65, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x2c, 0x0a, 0x0a,
0x68, 0x61, 0x73, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x35, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,
0x09, 0x68, 0x61, 0x73, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6c, 0x69,
0x6d, 0x69, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x63,
0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x36, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x6c, 0x69,
0x6d, 0x69, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e,
0x6e, 0x65, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6e, 0x79, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75,
0x61, 0x67, 0x65, 0x73, 0x18, 0x37, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x79, 0x4c,
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x5f,
0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x18, 0x38, 0x20, 0x03, 0x28, 0x09, 0x52,
0x0c, 0x61, 0x6c, 0x6c, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2b, 0x0a,
0x11, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
0x65, 0x73, 0x18, 0x39, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65,
0x44, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f,
0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x18, 0x3a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e,
0x6f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x32, 0x31, 0x0a, 0x03, 0x48, 0x75, 0x62, 0x12, 0x2a,
0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65,
0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x70, 0x62,
0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x62, 0x72, 0x79, 0x69, 0x6f, 0x2f,
0x68, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x6f, 0x2f,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
>>>>>>> origin/master
} }
var ( var (
@ -1095,6 +1426,7 @@ func file_hub_proto_rawDescGZIP() []byte {
var file_hub_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_hub_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_hub_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_hub_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_hub_proto_goTypes = []interface{}{ var file_hub_proto_goTypes = []interface{}{
<<<<<<< HEAD
(RangeField_Op)(0), // 0: pb.RangeField.Op (RangeField_Op)(0), // 0: pb.RangeField.Op
(*EmptyMessage)(nil), // 1: pb.EmptyMessage (*EmptyMessage)(nil), // 1: pb.EmptyMessage
(*InvertibleField)(nil), // 2: pb.InvertibleField (*InvertibleField)(nil), // 2: pb.InvertibleField
@ -1170,6 +1502,50 @@ var file_hub_proto_depIdxs = []int32{
35, // [35:35] is the sub-list for extension type_name 35, // [35:35] is the sub-list for extension type_name
35, // [35:35] is the sub-list for extension extendee 35, // [35:35] is the sub-list for extension extendee
0, // [0:35] is the sub-list for field type_name 0, // [0:35] is the sub-list for field type_name
=======
(RangeField_Op)(0), // 0: pb.RangeField.Op
(*InvertibleField)(nil), // 1: pb.InvertibleField
(*BoolValue)(nil), // 2: pb.BoolValue
(*UInt32Value)(nil), // 3: pb.UInt32Value
(*RangeField)(nil), // 4: pb.RangeField
(*SearchRequest)(nil), // 5: pb.SearchRequest
(*Outputs)(nil), // 6: pb.Outputs
}
var file_hub_proto_depIdxs = []int32{
0, // 0: pb.RangeField.op:type_name -> pb.RangeField.Op
1, // 1: pb.SearchRequest.claim_id:type_name -> pb.InvertibleField
1, // 2: pb.SearchRequest.channel_id:type_name -> pb.InvertibleField
4, // 3: pb.SearchRequest.tx_position:type_name -> pb.RangeField
4, // 4: pb.SearchRequest.amount:type_name -> pb.RangeField
4, // 5: pb.SearchRequest.timestamp:type_name -> pb.RangeField
4, // 6: pb.SearchRequest.creation_timestamp:type_name -> pb.RangeField
4, // 7: pb.SearchRequest.height:type_name -> pb.RangeField
4, // 8: pb.SearchRequest.creation_height:type_name -> pb.RangeField
4, // 9: pb.SearchRequest.activation_height:type_name -> pb.RangeField
4, // 10: pb.SearchRequest.expiration_height:type_name -> pb.RangeField
4, // 11: pb.SearchRequest.release_time:type_name -> pb.RangeField
4, // 12: pb.SearchRequest.repost_count:type_name -> pb.RangeField
4, // 13: pb.SearchRequest.fee_amount:type_name -> pb.RangeField
4, // 14: pb.SearchRequest.duration:type_name -> pb.RangeField
4, // 15: pb.SearchRequest.censor_type:type_name -> pb.RangeField
4, // 16: pb.SearchRequest.channel_join:type_name -> pb.RangeField
2, // 17: pb.SearchRequest.is_signature_valid:type_name -> pb.BoolValue
4, // 18: pb.SearchRequest.effective_amount:type_name -> pb.RangeField
4, // 19: pb.SearchRequest.support_amount:type_name -> pb.RangeField
4, // 20: pb.SearchRequest.trending_group:type_name -> pb.RangeField
4, // 21: pb.SearchRequest.trending_mixed:type_name -> pb.RangeField
4, // 22: pb.SearchRequest.trending_local:type_name -> pb.RangeField
4, // 23: pb.SearchRequest.trending_global:type_name -> pb.RangeField
3, // 24: pb.SearchRequest.tx_nout:type_name -> pb.UInt32Value
2, // 25: pb.SearchRequest.has_source:type_name -> pb.BoolValue
5, // 26: pb.Hub.Search:input_type -> pb.SearchRequest
6, // 27: pb.Hub.Search:output_type -> pb.Outputs
27, // [27:28] is the sub-list for method output_type
26, // [26:27] is the sub-list for method input_type
26, // [26:26] is the sub-list for extension type_name
26, // [26:26] is the sub-list for extension extendee
0, // [0:26] is the sub-list for field type_name
>>>>>>> origin/master
} }
func init() { file_hub_proto_init() } func init() { file_hub_proto_init() }
@ -1192,7 +1568,11 @@ func file_hub_proto_init() {
} }
} }
file_hub_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_hub_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
<<<<<<< HEAD
switch v := v.(*InvertibleField); i { switch v := v.(*InvertibleField); i {
=======
switch v := v.(*BoolValue); i {
>>>>>>> origin/master
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1204,7 +1584,11 @@ func file_hub_proto_init() {
} }
} }
file_hub_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_hub_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
<<<<<<< HEAD
switch v := v.(*RangeField); i { switch v := v.(*RangeField); i {
=======
switch v := v.(*UInt32Value); i {
>>>>>>> origin/master
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1216,6 +1600,21 @@ func file_hub_proto_init() {
} }
} }
file_hub_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_hub_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
<<<<<<< HEAD
=======
switch v := v.(*RangeField); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_hub_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
>>>>>>> origin/master
switch v := v.(*SearchRequest); i { switch v := v.(*SearchRequest); i {
case 0: case 0:
return &v.state return &v.state

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.26.0 // protoc-gen-go v1.26.0
// protoc v3.17.1 // protoc v3.17.3
// source: result.proto // source: result.proto
package pb package pb

View file

@ -14,7 +14,6 @@ import (
//"github.com/lbryio/hub/schema" //"github.com/lbryio/hub/schema"
"github.com/btcsuite/btcutil/base58" "github.com/btcsuite/btcutil/base58"
"github.com/golang/protobuf/ptypes/wrappers"
pb "github.com/lbryio/hub/protobuf/go" pb "github.com/lbryio/hub/protobuf/go"
"github.com/lbryio/lbry.go/v2/extras/util" "github.com/lbryio/lbry.go/v2/extras/util"
"github.com/olivere/elastic/v7" "github.com/olivere/elastic/v7"
@ -73,6 +72,13 @@ func AddTermsField(q *elastic.BoolQuery, arr []string, name string) *elastic.Boo
return q.Must(elastic.NewTermsQuery(name, searchVals...)) return q.Must(elastic.NewTermsQuery(name, searchVals...))
} }
func AddTermField(q *elastic.BoolQuery, value string, name string) *elastic.BoolQuery {
if value != "" {
return q.Must(elastic.NewTermQuery(name, value))
}
return q
}
func AddIndividualTermFields(q *elastic.BoolQuery, arr []string, name string, invert bool) *elastic.BoolQuery { func AddIndividualTermFields(q *elastic.BoolQuery, arr []string, name string, invert bool) *elastic.BoolQuery {
for _, x := range arr { for _, x := range arr {
if invert { if invert {
@ -171,32 +177,19 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
var from = 0 var from = 0
var pageSize = 10 var pageSize = 10
var orderBy []orderField var orderBy []orderField
var searchIndices = []string{} var searchIndices []string
client := s.EsClient
searchIndices = make([]string, 0, 1)
searchIndices = append(searchIndices, s.Args.EsIndex)
q := elastic.NewBoolQuery() q := elastic.NewBoolQuery()
err := s.checkQuery(in)
if err != nil {
return nil, err
}
q = s.setupEsQuery(q, in, &pageSize, &from, &orderBy) q = s.setupEsQuery(q, in, &pageSize, &from, &orderBy)
if s.Args.Dev && len(in.SearchIndices) == 0 {
// If we're running in dev mode ignore the mainnet claims index
indices, err := client.IndexNames()
if err != nil {
s.recordErrorAndDie(err)
}
var numIndices = len(indices)
searchIndices = make([]string, 0, numIndices)
for i := 0; i < numIndices; i++ {
if indices[i] == "claims" {
continue
}
searchIndices = append(searchIndices, indices[i])
}
}
if len(in.SearchIndices) > 0 {
searchIndices = in.SearchIndices
}
fsc := elastic.NewFetchSourceContext(true).Exclude("description", "title") fsc := elastic.NewFetchSourceContext(true).Exclude("description", "title")
search := client.Search(). search := client.Search().
Index(searchIndices...). Index(searchIndices...).
@ -209,8 +202,13 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
} }
searchResult, err := search.Do(ctx) // execute searchResult, err := search.Do(ctx) // execute
if err != nil { if err != nil && elastic.IsNotFound(err) {
log.Println("Index returned 404! Check writer. Index: ", searchIndices)
return &pb.Outputs{}, nil
} else if err != nil {
s.recordErrorAndReturn(err, "search_errors") s.recordErrorAndReturn(err, "search_errors")
log.Println("Error executing query: ", err)
return nil, err return nil, err
} }
@ -226,10 +224,10 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
if in.NoTotals != nil && !in.NoTotals.Value { if in.NoTotals != nil && !in.NoTotals.Value {
return &pb.Outputs{ return &pb.Outputs{
Txos: txos, Txos: txos,
ExtraTxos: extraTxos, ExtraTxos: extraTxos,
Offset: uint32(int64(from) + searchResult.TotalHits()), Offset: uint32(int64(from) + searchResult.TotalHits()),
Blocked: blocked, Blocked: blocked,
}, nil }, nil
} }
@ -238,11 +236,11 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
blockedTotal += b.Count blockedTotal += b.Count
} }
return &pb.Outputs{ return &pb.Outputs{
Txos: txos, Txos: txos,
ExtraTxos: extraTxos, ExtraTxos: extraTxos,
Total: uint32(searchResult.TotalHits()), Total: uint32(searchResult.TotalHits()),
Offset: uint32(int64(from) + searchResult.TotalHits()), Offset: uint32(int64(from) + searchResult.TotalHits()),
Blocked: blocked, Blocked: blocked,
BlockedTotal: blockedTotal, BlockedTotal: blockedTotal,
}, nil }, nil
} }
@ -258,7 +256,6 @@ func (s *Server) normalizeTag(tag string) string {
return string(res) return string(res)
} }
func (s *Server) cleanTags(tags []string) []string { func (s *Server) cleanTags(tags []string) []string {
cleanedTags := make([]string, len(tags)) cleanedTags := make([]string, len(tags))
for i, tag := range tags { for i, tag := range tags {
@ -293,26 +290,23 @@ func (s *Server) postProcessResults(
//printJsonFullResults(searchResult) //printJsonFullResults(searchResult)
records, blockedRecords, blockedMap = removeBlocked(records) records, blockedRecords, blockedMap = removeBlocked(records)
if in.RemoveDuplicates != nil { if in.RemoveDuplicates {
records = removeDuplicates(records) records = removeDuplicates(records)
} }
if in.LimitClaimsPerChannel != nil && in.LimitClaimsPerChannel.Value > 0 { if in.LimitClaimsPerChannel > 0 {
records = searchAhead(records, pageSize, int(in.LimitClaimsPerChannel.Value)) records = searchAhead(records, pageSize, int(in.LimitClaimsPerChannel))
} }
finalLength := int(math.Min(float64(len(records)), float64(pageSize))) finalLength := int(math.Min(float64(len(records)), float64(pageSize)))
txos = make([]*pb.Output, 0, finalLength) txos = make([]*pb.Output, 0, finalLength)
var j = 0 var j = 0
for i := from; i < from + finalLength && i < len(records) && j < finalLength; i++ { for i := from; i < from+finalLength && i < len(records) && j < finalLength; i++ {
t := records[i] t := records[i]
res := t.recordToOutput() res := t.recordToOutput()
txos = append(txos, res) txos = append(txos, res)
j += 1 j += 1
} }
//printJsonFullRecords(blockedRecords)
//Get claims for reposts //Get claims for reposts
repostClaims, repostRecords, repostedMap := s.getClaimsForReposts(ctx, client, records, searchIndices) repostClaims, repostRecords, repostedMap := s.getClaimsForReposts(ctx, client, records, searchIndices)
//get all unique channels //get all unique channels
@ -343,82 +337,91 @@ func (s *Server) postProcessResults(
return txos, extraTxos, blocked return txos, extraTxos, blocked
} }
func (s *Server) checkQuery(in *pb.SearchRequest) error {
limit := 2048
checks := map[string]bool{
"claim_ids": in.ClaimId != nil && !in.ClaimId.Invert && len(in.ClaimId.Value) > limit,
"not_claim_ids": in.ClaimId != nil && in.ClaimId.Invert && len(in.ClaimId.Value) > limit,
"channel_ids": in.ChannelId != nil && !in.ChannelId.Invert && len(in.ChannelId.Value) > limit,
"not_channel_ids": in.ChannelId != nil && in.ChannelId.Invert && len(in.ChannelId.Value) > limit,
"not_tags": len(in.NotTags) > limit,
"all_tags": len(in.AllTags) > limit,
"any_tags": len(in.AnyTags) > limit,
"any_languages": len(in.AnyLanguages) > limit,
}
for name, failed := range checks {
if failed {
time.Sleep(2) // throttle
return fmt.Errorf("%s cant have more than %d items", name, limit)
}
}
return nil
}
func (s *Server) setupEsQuery( func (s *Server) setupEsQuery(
q *elastic.BoolQuery, q *elastic.BoolQuery,
in *pb.SearchRequest, in *pb.SearchRequest,
pageSize *int, pageSize *int,
from *int, from *int,
orderBy *[]orderField) *elastic.BoolQuery { orderBy *[]orderField) *elastic.BoolQuery {
claimTypes := map[string]int { claimTypes := map[string]int{
"stream": 1, "stream": 1,
"channel": 2, "channel": 2,
"repost": 3, "repost": 3,
"collection": 4, "collection": 4,
} }
streamTypes := map[string]int { streamTypes := map[string]int{
"video": 1, "video": 1,
"audio": 2, "audio": 2,
"image": 3, "image": 3,
"document": 4, "document": 4,
"binary": 5, "binary": 5,
"model": 6, "model": 6,
} }
replacements := map[string]string { replacements := map[string]string{
"name": "normalized_name", "name": "normalized_name",
"txid": "tx_id", "txid": "tx_id",
//"claim_hash": "_id", "claim_hash": "_id",
"reposted": "repost_count",
} }
textFields := map[string]bool { textFields := map[string]bool{
"author": true, "author": true,
"canonical_url": true, "canonical_url": true,
"channel_id": true, "channel_id": true,
"claim_name": true, "claim_name": true,
"description": true, "description": true,
"claim_id": true, "claim_id": true,
"media_type": true, "media_type": true,
"normalized_name": true, "normalized_name": true,
"public_key_bytes": true, "public_key_bytes": true,
"public_key_hash": true, "public_key_id": true,
"public_key_id": true, "short_url": true,
"short_url": true, "signature": true,
"signature": true, "signature_digest": true,
"signature_digest": true, "stream_type": true,
"stream_type": true, "title": true,
"title": true, "tx_id": true,
"tx_id": true, "fee_currency": true,
"fee_currency": true,
"reposted_claim_id": true, "reposted_claim_id": true,
"tags": true, "tags": true,
} }
if in.IsControlling != nil { if in.IsControlling {
q = q.Must(elastic.NewTermQuery("is_controlling", in.IsControlling.Value)) q = q.Must(elastic.NewTermQuery("is_controlling", in.IsControlling))
} }
if in.AmountOrder != nil { if in.Limit > 0 {
in.Limit.Value = 1 *pageSize = int(in.Limit)
in.OrderBy = []string{"effective_amount"}
in.Offset = &wrappers.Int32Value{Value: in.AmountOrder.Value - 1}
} }
if in.Limit != nil { if in.Offset > 0 {
*pageSize = int(in.Limit.Value) *from = int(in.Offset)
} }
if in.Offset != nil { if len(in.ClaimName) > 0 {
*from = int(in.Offset.Value) in.NormalizedName = util.NormalizeName(in.ClaimName)
}
if len(in.Name) > 0 {
normalized := make([]string, len(in.Name))
for i := 0; i < len(in.Name); i++ {
normalized[i] = util.NormalizeName(in.Name[i])
}
in.NormalizedName = normalized
} }
if len(in.OrderBy) > 0 { if len(in.OrderBy) > 0 {
@ -458,21 +461,6 @@ func (s *Server) setupEsQuery(
q = q.Must(elastic.NewTermsQuery("stream_type", searchVals...)) q = q.Must(elastic.NewTermsQuery("stream_type", searchVals...))
} }
if len(in.XId) > 0 {
searchVals := make([]interface{}, len(in.XId))
for i := 0; i < len(in.XId); i++ {
util.ReverseBytesInPlace(in.XId[i])
searchVals[i] = hex.Dump(in.XId[i])
}
if len(in.XId) == 1 && len(in.XId[0]) < 20 {
q = q.Must(elastic.NewPrefixQuery("_id", string(in.XId[0])))
} else {
q = q.Must(elastic.NewTermsQuery("_id", searchVals...))
}
}
if in.ClaimId != nil { if in.ClaimId != nil {
searchVals := StrArrToInterface(in.ClaimId.Value) searchVals := StrArrToInterface(in.ClaimId.Value)
if len(in.ClaimId.Value) == 1 && len(in.ClaimId.Value[0]) < 20 { if len(in.ClaimId.Value) == 1 && len(in.ClaimId.Value[0]) < 20 {
@ -495,7 +483,7 @@ func (s *Server) setupEsQuery(
q = q.Must(elastic.NewTermQuery("public_key_id.keyword", value)) q = q.Must(elastic.NewTermQuery("public_key_id.keyword", value))
} }
if in.HasChannelSignature != nil && in.HasChannelSignature.Value { if in.HasChannelSignature {
q = q.Must(elastic.NewExistsQuery("signature_digest")) q = q.Must(elastic.NewExistsQuery("signature_digest"))
if in.IsSignatureValid != nil { if in.IsSignatureValid != nil {
q = q.Must(elastic.NewTermQuery("is_signature_valid", in.IsSignatureValid.Value)) q = q.Must(elastic.NewTermQuery("is_signature_valid", in.IsSignatureValid.Value))
@ -518,21 +506,20 @@ func (s *Server) setupEsQuery(
q = q.Must(elastic.NewTermQuery("tx_nout", in.TxNout.Value)) q = q.Must(elastic.NewTermQuery("tx_nout", in.TxNout.Value))
} }
q = AddTermsField(q, in.Author, "author.keyword") q = AddTermField(q, in.Author, "author.keyword")
q = AddTermsField(q, in.Title, "title.keyword") q = AddTermField(q, in.Title, "title.keyword")
q = AddTermsField(q, in.CanonicalUrl, "canonical_url.keyword") q = AddTermField(q, in.CanonicalUrl, "canonical_url.keyword")
q = AddTermsField(q, in.ClaimName, "claim_name.keyword") q = AddTermField(q, in.ClaimName, "claim_name.keyword")
q = AddTermsField(q, in.Description, "description.keyword") q = AddTermField(q, in.Description, "description.keyword")
q = AddTermsField(q, in.MediaType, "media_type.keyword") q = AddTermsField(q, in.MediaType, "media_type.keyword")
q = AddTermsField(q, in.NormalizedName, "normalized_name.keyword") q = AddTermField(q, in.NormalizedName, "normalized_name.keyword")
q = AddTermsField(q, in.PublicKeyBytes, "public_key_bytes.keyword") q = AddTermField(q, in.PublicKeyBytes, "public_key_bytes.keyword")
q = AddTermsField(q, in.ShortUrl, "short_url.keyword") q = AddTermField(q, in.ShortUrl, "short_url.keyword")
q = AddTermsField(q, in.Signature, "signature.keyword") q = AddTermField(q, in.Signature, "signature.keyword")
q = AddTermsField(q, in.SignatureDigest, "signature_digest.keyword") q = AddTermField(q, in.SignatureDigest, "signature_digest.keyword")
q = AddTermsField(q, in.TxId, "tx_id.keyword") q = AddTermField(q, in.TxId, "tx_id.keyword")
q = AddTermsField(q, in.FeeCurrency, "fee_currency.keyword") q = AddTermField(q, in.FeeCurrency, "fee_currency.keyword")
q = AddTermsField(q, in.RepostedClaimId, "reposted_claim_id.keyword") q = AddTermField(q, in.RepostedClaimId, "reposted_claim_id.keyword")
q = AddTermsField(q, s.cleanTags(in.AnyTags), "tags.keyword") q = AddTermsField(q, s.cleanTags(in.AnyTags), "tags.keyword")
q = AddIndividualTermFields(q, s.cleanTags(in.AllTags), "tags.keyword", false) q = AddIndividualTermFields(q, s.cleanTags(in.AllTags), "tags.keyword", false)
@ -541,8 +528,6 @@ func (s *Server) setupEsQuery(
q = AddIndividualTermFields(q, in.AllLanguages, "languages", false) q = AddIndividualTermFields(q, in.AllLanguages, "languages", false)
q = AddInvertibleField(q, in.ChannelId, "channel_id.keyword") q = AddInvertibleField(q, in.ChannelId, "channel_id.keyword")
q = AddInvertibleField(q, in.ChannelIds, "channel_id.keyword")
q = AddRangeField(q, in.TxPosition, "tx_position") q = AddRangeField(q, in.TxPosition, "tx_position")
q = AddRangeField(q, in.Amount, "amount") q = AddRangeField(q, in.Amount, "amount")
@ -635,13 +620,13 @@ func (s *Server) getUniqueChannels(records []*record, client *elastic.Client, ct
func (s * Server) getClaimsForReposts(ctx context.Context, client *elastic.Client, records []*record, searchIndices []string) ([]*pb.Output, []*record, map[string]*pb.Output) { func (s * Server) getClaimsForReposts(ctx context.Context, client *elastic.Client, records []*record, searchIndices []string) ([]*pb.Output, []*record, map[string]*pb.Output) {
var totalReposted = 0 var totalReposted = 0
var mget = client.Mget()//.StoredFields("_id") var mget = client.Mget() //.StoredFields("_id")
/* /*
var nmget = elastic.NewMultiGetItem() var nmget = elastic.NewMultiGetItem()
for _, index := range searchIndices { for _, index := range searchIndices {
nmget = nmget.Index(index) nmget = nmget.Index(index)
} }
*/ */
for _, r := range records { for _, r := range records {
for _, searchIndex := range searchIndices { for _, searchIndex := range searchIndices {
if r.RepostedClaimId != "" { if r.RepostedClaimId != "" {
@ -685,7 +670,7 @@ func (s * Server) getClaimsForReposts(ctx context.Context, client *elastic.Clien
} }
func searchAhead(searchHits []*record, pageSize int, perChannelPerPage int) []*record { func searchAhead(searchHits []*record, pageSize int, perChannelPerPage int) []*record {
finalHits := make([]*record, 0 , len(searchHits)) finalHits := make([]*record, 0, len(searchHits))
var channelCounters map[string]int var channelCounters map[string]int
channelCounters = make(map[string]int) channelCounters = make(map[string]int)
nextPageHitsMaybeCheckLater := deque.New() nextPageHitsMaybeCheckLater := deque.New()
@ -694,7 +679,7 @@ func searchAhead(searchHits []*record, pageSize int, perChannelPerPage int) []*r
searchHitsQ.PushRight(rec) searchHitsQ.PushRight(rec)
} }
for !searchHitsQ.Empty() || !nextPageHitsMaybeCheckLater.Empty() { for !searchHitsQ.Empty() || !nextPageHitsMaybeCheckLater.Empty() {
if len(finalHits) > 0 && len(finalHits) % pageSize == 0 { if len(finalHits) > 0 && len(finalHits)%pageSize == 0 {
channelCounters = make(map[string]int) channelCounters = make(map[string]int)
} else if len(finalHits) != 0 { } else if len(finalHits) != 0 {
// means last page was incomplete and we are left with bad replacements // means last page was incomplete and we are left with bad replacements
@ -703,7 +688,7 @@ func searchAhead(searchHits []*record, pageSize int, perChannelPerPage int) []*r
for i := 0; i < nextPageHitsMaybeCheckLater.Size(); i++ { for i := 0; i < nextPageHitsMaybeCheckLater.Size(); i++ {
rec := nextPageHitsMaybeCheckLater.PopLeft().(*record) rec := nextPageHitsMaybeCheckLater.PopLeft().(*record)
if perChannelPerPage > 0 && channelCounters[rec.ChannelId] < perChannelPerPage { if perChannelPerPage > 0 && channelCounters[rec.ChannelId] < perChannelPerPage {
finalHits = append(finalHits, rec) finalHits = append(finalHits, rec)
channelCounters[rec.ChannelId] = channelCounters[rec.ChannelId] + 1 channelCounters[rec.ChannelId] = channelCounters[rec.ChannelId] + 1
} }
@ -715,7 +700,7 @@ func searchAhead(searchHits []*record, pageSize int, perChannelPerPage int) []*r
} else if channelCounters[hit.ChannelId] < perChannelPerPage { } else if channelCounters[hit.ChannelId] < perChannelPerPage {
finalHits = append(finalHits, hit) finalHits = append(finalHits, hit)
channelCounters[hit.ChannelId] = channelCounters[hit.ChannelId] + 1 channelCounters[hit.ChannelId] = channelCounters[hit.ChannelId] + 1
if len(finalHits) % pageSize == 0 { if len(finalHits)%pageSize == 0 {
break break
} }
} else { } else {
@ -726,15 +711,6 @@ func searchAhead(searchHits []*record, pageSize int, perChannelPerPage int) []*r
return finalHits return finalHits
} }
func (r *record) recordToChannelOutput() *pb.Output {
// Don't nee dthe meta for this one
return &pb.Output{
TxHash: util.TxIdToTxHash(r.Txid),
Nout: r.Nout,
Height: r.Height,
}
}
func (r *record) recordToOutput() *pb.Output { func (r *record) recordToOutput() *pb.Output {
return &pb.Output{ return &pb.Output{
TxHash: util.TxIdToTxHash(r.Txid), TxHash: util.TxIdToTxHash(r.Txid),
@ -781,13 +757,12 @@ func removeDuplicates(searchHits []*record) []*record {
hitHeight := hit.Height hitHeight := hit.Height
hitId := hit.getHitId() hitId := hit.getHitId()
if knownIds[hitId] == nil { if knownIds[hitId] == nil {
knownIds[hitId] = hit knownIds[hitId] = hit
} else { } else {
prevHit := knownIds[hitId] prevHit := knownIds[hitId]
if hitHeight < prevHit.Height { if hitHeight < prevHit.Height {
knownIds[hitId] = hit knownIds[hitId] = hit
dropped[prevHit] = true dropped[prevHit] = true
} else { } else {
dropped[hit] = true dropped[hit] = true
@ -795,7 +770,7 @@ func removeDuplicates(searchHits []*record) []*record {
} }
} }
deduped := make([]*record, len(searchHits) - len(dropped)) deduped := make([]*record, len(searchHits)-len(dropped))
var i = 0 var i = 0
for _, hit := range searchHits { for _, hit := range searchHits {
@ -816,7 +791,7 @@ func removeBlocked(searchHits []*record) ([]*record, []*record, map[string]*pb.B
if r.CensorType != 0 { if r.CensorType != 0 {
if blockedChannels[r.CensoringChannelId] == nil { if blockedChannels[r.CensoringChannelId] == nil {
blockedObj := &pb.Blocked{ blockedObj := &pb.Blocked{
Count: 1, Count: 1,
Channel: nil, Channel: nil,
} }
blockedChannels[r.CensoringChannelId] = blockedObj blockedChannels[r.CensoringChannelId] = blockedObj
@ -831,35 +806,3 @@ func removeBlocked(searchHits []*record) ([]*record, []*record, map[string]*pb.B
return newHits, blockedHits, blockedChannels return newHits, blockedHits, blockedChannels
} }
func printJsonFullRecords(records []*record) {
// or if you want more control
for _, r := range records {
// hit.Index contains the name of the index
b, err := json.MarshalIndent(r, "", " ")
if err != nil {
fmt.Println("error:", err)
}
fmt.Println(string(b))
}
}
func printJsonFullResults(searchResult *elastic.SearchResult) {
// or if you want more control
for _, hit := range searchResult.Hits.Hits {
// hit.Index contains the name of the index
var t map[string]interface{} // or could be a Record
err := json.Unmarshal(hit.Source, &t)
if err != nil {
return
}
b, err := json.MarshalIndent(t, "", " ")
if err != nil {
fmt.Println("error:", err)
}
fmt.Println(string(b))
}
}

View file

@ -1,8 +1,10 @@
package server package server
import ( import (
"context" "log"
"fmt" "os"
"regexp"
pb "github.com/lbryio/hub/protobuf/go" pb "github.com/lbryio/hub/protobuf/go"
"github.com/olivere/elastic/v7" "github.com/olivere/elastic/v7"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
@ -16,7 +18,7 @@ import (
type Server struct { type Server struct {
GrpcServer *grpc.Server GrpcServer *grpc.Server
Args *Args Args *Args
MultiSpaceRe *regexp.Regexp MultiSpaceRe *regexp.Regexp
WeirdCharsRe *regexp.Regexp WeirdCharsRe *regexp.Regexp
EsClient *elastic.Client EsClient *elastic.Client
@ -41,11 +43,12 @@ const (
type Args struct { type Args struct {
// TODO Make command types an enum // TODO Make command types an enum
CmdType int CmdType int
Host string Host string
Port string Port string
EsHost string EsHost string
EsPort string EsPort string
Dev bool EsIndex string
Debug bool
} }
func getVersion(alphaBeta string) string { func getVersion(alphaBeta string) string {
@ -99,7 +102,7 @@ func getVersion(alphaBeta string) string {
func MakeHubServer(args *Args) *Server { func MakeHubServer(args *Args) *Server {
grpcServer := grpc.NewServer(grpc.NumStreamWorkers(10)) grpcServer := grpc.NewServer(grpc.NumStreamWorkers(10))
multiSpaceRe, err := regexp.Compile("\\s{2,}") multiSpaceRe, err := regexp.Compile(`\s{2,}`)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -116,12 +119,22 @@ func MakeHubServer(args *Args) *Server {
} }
servers := make([]*FederatedServer, 10) servers := make([]*FederatedServer, 10)
servers = append(servers, self) servers = append(servers, self)
s := &Server {
GrpcServer: grpcServer, esUrl := args.EsHost + ":" + args.EsPort
Args: args, opts := []elastic.ClientOptionFunc{elastic.SetSniff(false), elastic.SetURL(esUrl)}
if args.Debug {
opts = append(opts, elastic.SetTraceLog(log.New(os.Stderr, "[[ELASTIC]]", 0)))
}
client, err := elastic.NewClient(opts...)
if err != nil {
log.Fatal(err)
}
s := &Server{
GrpcServer: grpcServer,
Args: args,
MultiSpaceRe: multiSpaceRe, MultiSpaceRe: multiSpaceRe,
WeirdCharsRe: weirdCharsRe, WeirdCharsRe: weirdCharsRe,
Servers: servers, EsClient: client,
} }
return s return s
@ -150,4 +163,4 @@ func (s *Server) Ping(context context.Context, args *pb.EmptyMessage) (*wrappers
func (s *Server) Version(context context.Context, args *pb.EmptyMessage) (*wrapperspb.StringValue, error) { func (s *Server) Version(context context.Context, args *pb.EmptyMessage) (*wrapperspb.StringValue, error) {
return &wrapperspb.StringValue{Value: getVersion("beta")}, nil return &wrapperspb.StringValue{Value: getVersion("beta")}, nil
} }