From f5382715bfc3f0ef1d26bf424b167290d937a430 Mon Sep 17 00:00:00 2001 From: Jeffrey Picard Date: Mon, 7 Mar 2022 19:28:36 +0000 Subject: [PATCH] logrus, protobuf updates, resolve grpc endpoint --- db/db.go | 61 ++- db/db_resolve.go | 17 +- db/db_stack/db_stack.go | 23 + db/db_test.go | 11 +- db/prefixes/prefixes.go | 2 - go.mod | 2 +- go.sum | 4 +- main.go | 6 +- protobuf/definitions/hub.proto | 15 +- protobuf/go/claim.pb.go | 2 +- protobuf/go/hub.pb.go | 36 +- protobuf/go/hub_grpc.pb.go | 40 ++ protobuf/go/result.pb.go | 2 +- protobuf/python/hub_pb2.py | 907 ++------------------------------ protobuf/python/hub_pb2_grpc.py | 33 ++ protobuf/python/result_pb2.py | 432 +-------------- server/server.go | 162 ++++++ 17 files changed, 406 insertions(+), 1349 deletions(-) diff --git a/db/db.go b/db/db.go index 4824299..4c3c863 100644 --- a/db/db.go +++ b/db/db.go @@ -39,16 +39,12 @@ const ( // type ReadOnlyDBColumnFamily struct { - DB *grocksdb.DB - Handles map[string]*grocksdb.ColumnFamilyHandle - Opts *grocksdb.ReadOptions - // TxCountIdx int32 // TODO: slice backed stack - // TxCounts []uint32 - TxCounts *db_stack.SliceBackedStack - Height uint32 - LastState *prefixes.DBStateValue - // HeaderIdx int32 // TODO: slice backed stack - // Headers []*prefixes.BlockHeaderValue + DB *grocksdb.DB + Handles map[string]*grocksdb.ColumnFamilyHandle + Opts *grocksdb.ReadOptions + TxCounts *db_stack.SliceBackedStack + Height uint32 + LastState *prefixes.DBStateValue Headers *db_stack.SliceBackedStack BlockedStreams map[string][]byte BlockedChannels map[string][]byte @@ -105,8 +101,6 @@ func (x *optionalResolveResultOrError) GetError() *ResolveError { } func (x *ResolveResult) String() string { - // return fmt.Sprintf("ResolveResult{Name: %s, NormalizedName: %s, ClaimHash: %s, TxNum: %d, Position: %d, TxHash: %s, Height: %d, Amount: %d, ShortUrl: %s, IsControlling: %v, CanonicalUrl: %s, CreationHeight: %d, ActivationHeight: %d, ExpirationHeight: %d, EffectiveAmount: %d, SupportAmount: %d, Reposted: %d, LastTakeoverHeight: %d, ClaimsInChannel: %d, ChannelHash: %s, RepostedClaimHash: %s, SignatureValid: %v}", - // x.Name, x.NormalizedName, hex.EncodeToString(x.ClaimHash), x.TxNum, x.Position, hex.EncodeToString(x.TxHash), x.Height, x.Amount, x.ShortUrl, x.IsControlling, x.CanonicalUrl, x.CreationHeight, x.ActivationHeight, x.ExpirationHeight, x.EffectiveAmount, x.SupportAmount, x.Reposted, x.LastTakeoverHeight, x.ClaimsInChannel, hex.EncodeToString(x.ChannelHash), hex.EncodeToString(x.RepostedClaimHash), x.SignatureValid) return fmt.Sprintf("%#v", x) } @@ -131,6 +125,15 @@ type ExpandedResolveResult struct { RepostedChannel OptionalResolveResultOrError } +func NewExpandedResolveResult() *ExpandedResolveResult { + return &ExpandedResolveResult{ + Stream: &optionalResolveResultOrError{}, + Channel: &optionalResolveResultOrError{}, + Repost: &optionalResolveResultOrError{}, + RepostedChannel: &optionalResolveResultOrError{}, + } +} + func (x *ExpandedResolveResult) String() string { return fmt.Sprintf("ExpandedResolveResult{Stream: %s, Channel: %s, Repost: %s, RepostedChannel: %s}", x.Stream, x.Channel, x.Repost, x.RepostedChannel) } @@ -295,13 +298,13 @@ func (opts *IterOptions) ReadRow(ch chan *prefixes.PrefixRowKV, prevKey *[]byte) var outValue interface{} = nil var err error = nil - // log.Println("keyData:", keyData) - // log.Println("valueData:", valueData) + log.Trace("keyData:", keyData) + log.Trace("valueData:", valueData) // We need to check the current key if we're not including the stop // key. if !opts.IncludeStop && opts.StopIteration(keyData) { - log.Println("ReadRow returning false") + log.Trace("ReadRow returning false") return false } @@ -312,7 +315,7 @@ func (opts *IterOptions) ReadRow(ch chan *prefixes.PrefixRowKV, prevKey *[]byte) if opts.IncludeKey && !opts.RawKey { outKey, err = prefixes.UnpackGenericKey(newKeyData) if err != nil { - log.Println(err) + log.Error(err) } } else if opts.IncludeKey { outKey = newKeyData @@ -326,7 +329,7 @@ func (opts *IterOptions) ReadRow(ch chan *prefixes.PrefixRowKV, prevKey *[]byte) if !opts.RawValue { outValue, err = prefixes.UnpackGenericValue(newKeyData, newValueData) if err != nil { - log.Println(err) + log.Error(err) } } else { outValue = newValueData @@ -336,13 +339,11 @@ func (opts *IterOptions) ReadRow(ch chan *prefixes.PrefixRowKV, prevKey *[]byte) key.Free() value.Free() - // log.Println("sending to channel") ch <- &prefixes.PrefixRowKV{ Key: outKey, Value: outValue, } *prevKey = newKeyData - // log.Println("*prevKey:", *prevKey) return true } @@ -525,24 +526,26 @@ func GetDBColumnFamlies(name string, secondayPath string, cfNames []string) (*Re func Advance(db *ReadOnlyDBColumnFamily, height uint32) { // TODO: assert tx_count not in self.db.tx_counts, f'boom {tx_count} in {len(self.db.tx_counts)} tx counts' if db.TxCounts.Len() != height { - log.Println("Error: tx count len:", db.TxCounts.Len(), "height:", height) + log.Error("tx count len:", db.TxCounts.Len(), "height:", height) return } headerObj, err := GetHeader(db, height) if err != nil { - log.Println("Error getting header:", err) + log.Error("getting header:", err) return } txCountObj, err := GetTxCount(db, height) if err != nil { - log.Println("Error getting tx count:", err) + log.Error("getting tx count:", err) return } txCount := txCountObj.TxCount if db.TxCounts.GetTip().(uint32) >= txCount { + log.Error("current tip should be less than new txCount", + "tx count tip:", db.TxCounts.GetTip(), "tx count:", txCount) } db.TxCounts.Push(txCount) @@ -586,11 +589,10 @@ func DetectChanges(db *ReadOnlyDBColumnFamily) error { return nil } - // log.Printf("db.LastState %#v, state: %#v", db.LastState, state) log.Debugf("db.LastState %#v, state: %#v", db.LastState, state) if db.LastState != nil && db.LastState.Height > state.Height { - log.Println("reorg detected, waiting until the writer has flushed the new blocks to advance") + log.Info("reorg detected, waiting until the writer has flushed the new blocks to advance") return nil } @@ -620,6 +622,7 @@ func DetectChanges(db *ReadOnlyDBColumnFamily) error { } if rewound { //TODO: reorg count metric + log.Warn("implement reorg count metric") } err = ReadDBState(db) @@ -629,15 +632,19 @@ func DetectChanges(db *ReadOnlyDBColumnFamily) error { if db.LastState == nil || lastHeight < state.Height { for height := lastHeight + 1; height <= state.Height; height++ { - log.Println("advancing to", height) + log.Info("advancing to", height) Advance(db, height) } //TODO: ClearCache + log.Warn("implement cache clearing") db.LastState = state //TODO: block count metric + log.Warn("implement block count metric") //TODO: update blocked streams //TODO: update filtered streams + log.Warn("implement updating blocked streams") + log.Warn("implement updating filtered streams") } return nil @@ -881,7 +888,7 @@ func readWriteRawNCF(db *grocksdb.DB, options *IterOptions, out string, n int, f file, err := os.Create(out) if err != nil { - log.Println(err) + log.Error(err) return } defer file.Close() @@ -923,7 +930,7 @@ func ReadWriteRawN(db *grocksdb.DB, options *IterOptions, out string, n int) { file, err := os.Create(out) if err != nil { - log.Println(err) + log.Error(err) return } defer file.Close() diff --git a/db/db_resolve.go b/db/db_resolve.go index ad19bbf..cb98115 100644 --- a/db/db_resolve.go +++ b/db/db_resolve.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/hex" "fmt" - "log" "math" "sort" "strings" @@ -12,6 +11,7 @@ import ( "github.com/lbryio/hub/db/prefixes" "github.com/lbryio/lbry.go/v2/extras/util" lbryurl "github.com/lbryio/lbry.go/v2/url" + log "github.com/sirupsen/logrus" ) // PrepareResolveResult prepares a ResolveResult to return @@ -185,6 +185,7 @@ func ResolveParsedUrl(db *ReadOnlyDBColumnFamily, parsed *PathSegment) (*Resolve } log.Println("nomalizedName:", normalizedName) log.Println("claimId:", parsed.claimId) + // max short id length var j int = 10 if len(parsed.claimId) < j { j = len(parsed.claimId) @@ -280,16 +281,14 @@ func ResolveClaimInChannel(db *ReadOnlyDBColumnFamily, channelHash []byte, norma } func Resolve(db *ReadOnlyDBColumnFamily, url string) *ExpandedResolveResult { - var res = &ExpandedResolveResult{ - Stream: nil, - Channel: nil, - Repost: nil, - RepostedChannel: nil, - } + var res = NewExpandedResolveResult() var channel *PathSegment = nil var stream *PathSegment = nil parsed, err := lbryurl.Parse(url, false) + + log.Printf("parsed: %#v", parsed) + if err != nil { res.Stream = &optionalResolveResultOrError{ err: &ResolveError{err}, @@ -297,8 +296,6 @@ func Resolve(db *ReadOnlyDBColumnFamily, url string) *ExpandedResolveResult { return res } - log.Printf("parsed: %#v\n", parsed) - // has stream in channel if strings.Compare(parsed.StreamName, "") != 0 && strings.Compare(parsed.ClaimName, "") != 0 { channel = &PathSegment{ @@ -475,6 +472,6 @@ func Resolve(db *ReadOnlyDBColumnFamily, url string) *ExpandedResolveResult { res: repostedChannel, } - log.Printf("parsed: %+v\n", parsed) + log.Printf("parsed: %#v\n", parsed) return res } diff --git a/db/db_stack/db_stack.go b/db/db_stack/db_stack.go index 3ffdf76..1eb3abe 100644 --- a/db/db_stack/db_stack.go +++ b/db/db_stack/db_stack.go @@ -1,18 +1,25 @@ package db_stack +import "sync" + type SliceBackedStack struct { slice []interface{} len uint32 + mut sync.RWMutex } func NewSliceBackedStack(size int) *SliceBackedStack { return &SliceBackedStack{ slice: make([]interface{}, size), len: 0, + mut: sync.RWMutex{}, } } func (s *SliceBackedStack) Push(v interface{}) { + s.mut.Lock() + defer s.mut.Unlock() + if s.len == uint32(len(s.slice)) { s.slice = append(s.slice, v) } else { @@ -22,6 +29,9 @@ func (s *SliceBackedStack) Push(v interface{}) { } func (s *SliceBackedStack) Pop() interface{} { + s.mut.Lock() + defer s.mut.Unlock() + if s.len == 0 { return nil } @@ -30,6 +40,9 @@ func (s *SliceBackedStack) Pop() interface{} { } func (s *SliceBackedStack) Get(i uint32) interface{} { + s.mut.RLock() + defer s.mut.RUnlock() + if i >= s.len { return nil } @@ -37,6 +50,9 @@ func (s *SliceBackedStack) Get(i uint32) interface{} { } func (s *SliceBackedStack) GetTip() interface{} { + s.mut.RLock() + defer s.mut.RUnlock() + if s.len == 0 { return nil } @@ -44,13 +60,20 @@ func (s *SliceBackedStack) GetTip() interface{} { } func (s *SliceBackedStack) Len() uint32 { + s.mut.RLock() + defer s.mut.RUnlock() + return s.len } func (s *SliceBackedStack) Cap() int { + s.mut.RLock() + defer s.mut.RUnlock() + return cap(s.slice) } func (s *SliceBackedStack) GetSlice() []interface{} { + // This is not thread safe so I won't bother with locking return s.slice } diff --git a/db/db_test.go b/db/db_test.go index 11e186f..80fa347 100644 --- a/db/db_test.go +++ b/db/db_test.go @@ -246,7 +246,8 @@ func TestCatFullDB(t *testing.T) { // url := "lbry://@Styxhexenhammer666#2/legacy-media-baron-les-moonves-(cbs#9" // url := "lbry://@lbry" // url := "lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a" - dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/" + dbPath := "/mnt/sda/wallet_server/_data/lbry-rocksdb/" + // dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/" secondaryPath := "asdf" db, err := dbpkg.GetProdDB(dbPath, secondaryPath) toDefer := func() { @@ -275,14 +276,16 @@ func TestCatFullDB(t *testing.T) { // TestOpenFullDB Tests running a resolve on a full db. func TestOpenFullDB(t *testing.T) { - t.Skip("Skipping full db test") + // t.Skip("Skipping full db test") // url := "lbry://@lothrop#2/lothrop-livestream-games-and-code#c" // "lbry://@lbry", "lbry://@lbry#3", "lbry://@lbry3f", "lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a", "lbry://@lbry:1", "lbry://@lbry$1" - url := "lbry://@Styxhexenhammer666#2/legacy-media-baron-les-moonves-(cbs#9" + // url := "lbry://@Styxhexenhammer666#2/legacy-media-baron-les-moonves-(cbs#9" // url := "lbry://@lbry" // url := "lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a" // url := "lbry://@lbry$1" - dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/" + url := "lbry://@lothrop:2/lothrop-livestream-games-and-code:c" + dbPath := "/mnt/sda/wallet_server/_data/lbry-rocksdb/" + // dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/" secondaryPath := "asdf" db, err := dbpkg.GetProdDB(dbPath, secondaryPath) toDefer := func() { diff --git a/db/prefixes/prefixes.go b/db/prefixes/prefixes.go index 2d83362..ff6ac9e 100644 --- a/db/prefixes/prefixes.go +++ b/db/prefixes/prefixes.go @@ -201,7 +201,6 @@ func (v *DBStateValue) PackValue() []byte { binary.BigEndian.PutUint32(value[32+4+4+32+4+4+1+1+4:], compFlushCount) binary.BigEndian.PutUint32(value[32+4+4+32+4+4+1+1+4+4:], compCursor) binary.BigEndian.PutUint32(value[32+4+4+32+4+4+1+1+4+4+4:], v.EsSyncHeight) - log.Printf("%+v\n", v) return value } @@ -250,7 +249,6 @@ func DBStateValueUnpack(value []byte) *DBStateValue { CompCursor: int32(^binary.BigEndian.Uint32(value[32+4+4+32+4+4+1+1+4+4:])), EsSyncHeight: binary.BigEndian.Uint32(value[32+4+4+32+4+4+1+1+4+4+4:]), } - log.Printf("%+v\n", x) return x } diff --git a/go.mod b/go.mod index 01b1714..7db5d57 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/cespare/xxhash/v2 v2.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-errors/errors v1.1.1 // indirect - github.com/golang/protobuf v1.5.0 // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/gorilla/websocket v1.4.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect diff --git a/go.sum b/go.sum index 2680cb6..f44ee8e 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,9 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -303,6 +304,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/main.go b/main.go index 8bf61bc..262ff01 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,6 @@ import ( "context" "encoding/hex" "fmt" - "log" "time" "github.com/lbryio/hub/db" @@ -13,11 +12,16 @@ import ( pb "github.com/lbryio/hub/protobuf/go" "github.com/lbryio/hub/server" "github.com/lbryio/lbry.go/v2/extras/util" + log "github.com/sirupsen/logrus" "google.golang.org/grpc" ) func main() { + log.SetFormatter(&log.TextFormatter{ + FullTimestamp: true, + }) + ctx := context.Background() searchRequest := &pb.SearchRequest{} diff --git a/protobuf/definitions/hub.proto b/protobuf/definitions/hub.proto index c24c3ce..dc866be 100644 --- a/protobuf/definitions/hub.proto +++ b/protobuf/definitions/hub.proto @@ -6,14 +6,15 @@ import "result.proto"; package pb; service Hub { - rpc Search (SearchRequest) returns (Outputs) {} - rpc Ping (EmptyMessage) returns (StringValue) {} - rpc Hello (HelloMessage) returns (HelloMessage) {} - rpc AddPeer (ServerMessage) returns (StringValue) {} - rpc PeerSubscribe (ServerMessage) returns (StringValue) {} - rpc Version (EmptyMessage) returns (StringValue) {} - rpc Features (EmptyMessage) returns (StringValue) {} + rpc Search(SearchRequest) returns (Outputs) {} + rpc Ping(EmptyMessage) returns (StringValue) {} + rpc Hello(HelloMessage) returns (HelloMessage) {} + rpc AddPeer(ServerMessage) returns (StringValue) {} + rpc PeerSubscribe(ServerMessage) returns (StringValue) {} + rpc Version(EmptyMessage) returns (StringValue) {} + rpc Features(EmptyMessage) returns (StringValue) {} rpc Broadcast(EmptyMessage) returns (UInt32Value) {} + rpc Resolve(StringValue) returns (Outputs) {} } message EmptyMessage {} diff --git a/protobuf/go/claim.pb.go b/protobuf/go/claim.pb.go index 0f501c7..20df646 100644 --- a/protobuf/go/claim.pb.go +++ b/protobuf/go/claim.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 +// protoc-gen-go v1.27.1 // protoc v3.17.1 // source: claim.proto diff --git a/protobuf/go/hub.pb.go b/protobuf/go/hub.pb.go index 45c0041..50d6b3c 100644 --- a/protobuf/go/hub.pb.go +++ b/protobuf/go/hub.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 +// protoc-gen-go v1.27.1 // protoc v3.17.1 // source: hub.proto @@ -1126,7 +1126,7 @@ var file_hub_proto_rawDesc = []byte{ 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, 0x88, 0x03, 0x0a, 0x03, 0x48, 0x75, 0x62, 0x12, 0x2a, + 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x32, 0xb3, 0x03, 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, 0x12, 0x2b, 0x0a, 0x04, 0x50, 0x69, @@ -1151,10 +1151,12 @@ var file_hub_proto_rawDesc = []byte{ 0x30, 0x0a, 0x09, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 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, + 0x00, 0x12, 0x29, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x0f, 0x2e, 0x70, + 0x62, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 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, } var ( @@ -1216,16 +1218,18 @@ var file_hub_proto_depIdxs = []int32{ 1, // 28: pb.Hub.Version:input_type -> pb.EmptyMessage 1, // 29: pb.Hub.Features:input_type -> pb.EmptyMessage 1, // 30: pb.Hub.Broadcast:input_type -> pb.EmptyMessage - 10, // 31: pb.Hub.Search:output_type -> pb.Outputs - 5, // 32: pb.Hub.Ping:output_type -> pb.StringValue - 3, // 33: pb.Hub.Hello:output_type -> pb.HelloMessage - 5, // 34: pb.Hub.AddPeer:output_type -> pb.StringValue - 5, // 35: pb.Hub.PeerSubscribe:output_type -> pb.StringValue - 5, // 36: pb.Hub.Version:output_type -> pb.StringValue - 5, // 37: pb.Hub.Features:output_type -> pb.StringValue - 7, // 38: pb.Hub.Broadcast:output_type -> pb.UInt32Value - 31, // [31:39] is the sub-list for method output_type - 23, // [23:31] is the sub-list for method input_type + 5, // 31: pb.Hub.Resolve:input_type -> pb.StringValue + 10, // 32: pb.Hub.Search:output_type -> pb.Outputs + 5, // 33: pb.Hub.Ping:output_type -> pb.StringValue + 3, // 34: pb.Hub.Hello:output_type -> pb.HelloMessage + 5, // 35: pb.Hub.AddPeer:output_type -> pb.StringValue + 5, // 36: pb.Hub.PeerSubscribe:output_type -> pb.StringValue + 5, // 37: pb.Hub.Version:output_type -> pb.StringValue + 5, // 38: pb.Hub.Features:output_type -> pb.StringValue + 7, // 39: pb.Hub.Broadcast:output_type -> pb.UInt32Value + 10, // 40: pb.Hub.Resolve:output_type -> pb.Outputs + 32, // [32:41] is the sub-list for method output_type + 23, // [23:32] is the sub-list for method input_type 23, // [23:23] is the sub-list for extension type_name 23, // [23:23] is the sub-list for extension extendee 0, // [0:23] is the sub-list for field type_name diff --git a/protobuf/go/hub_grpc.pb.go b/protobuf/go/hub_grpc.pb.go index fdfb394..ed7e061 100644 --- a/protobuf/go/hub_grpc.pb.go +++ b/protobuf/go/hub_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.17.1 +// source: hub.proto package pb @@ -26,6 +30,7 @@ type HubClient interface { Version(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*StringValue, error) Features(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*StringValue, error) Broadcast(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*UInt32Value, error) + Resolve(ctx context.Context, in *StringValue, opts ...grpc.CallOption) (*Outputs, error) } type hubClient struct { @@ -108,6 +113,15 @@ func (c *hubClient) Broadcast(ctx context.Context, in *EmptyMessage, opts ...grp return out, nil } +func (c *hubClient) Resolve(ctx context.Context, in *StringValue, opts ...grpc.CallOption) (*Outputs, error) { + out := new(Outputs) + err := c.cc.Invoke(ctx, "/pb.Hub/Resolve", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // HubServer is the server API for Hub service. // All implementations must embed UnimplementedHubServer // for forward compatibility @@ -120,6 +134,7 @@ type HubServer interface { Version(context.Context, *EmptyMessage) (*StringValue, error) Features(context.Context, *EmptyMessage) (*StringValue, error) Broadcast(context.Context, *EmptyMessage) (*UInt32Value, error) + Resolve(context.Context, *StringValue) (*Outputs, error) mustEmbedUnimplementedHubServer() } @@ -151,6 +166,9 @@ func (UnimplementedHubServer) Features(context.Context, *EmptyMessage) (*StringV func (UnimplementedHubServer) Broadcast(context.Context, *EmptyMessage) (*UInt32Value, error) { return nil, status.Errorf(codes.Unimplemented, "method Broadcast not implemented") } +func (UnimplementedHubServer) Resolve(context.Context, *StringValue) (*Outputs, error) { + return nil, status.Errorf(codes.Unimplemented, "method Resolve not implemented") +} func (UnimplementedHubServer) mustEmbedUnimplementedHubServer() {} // UnsafeHubServer may be embedded to opt out of forward compatibility for this service. @@ -308,6 +326,24 @@ func _Hub_Broadcast_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Hub_Resolve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StringValue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HubServer).Resolve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.Hub/Resolve", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HubServer).Resolve(ctx, req.(*StringValue)) + } + return interceptor(ctx, in, info, handler) +} + // Hub_ServiceDesc is the grpc.ServiceDesc for Hub service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -347,6 +383,10 @@ var Hub_ServiceDesc = grpc.ServiceDesc{ MethodName: "Broadcast", Handler: _Hub_Broadcast_Handler, }, + { + MethodName: "Resolve", + Handler: _Hub_Resolve_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "hub.proto", diff --git a/protobuf/go/result.pb.go b/protobuf/go/result.pb.go index b655b73..e3eb42f 100644 --- a/protobuf/go/result.pb.go +++ b/protobuf/go/result.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 +// protoc-gen-go v1.27.1 // protoc v3.17.1 // source: result.proto diff --git a/protobuf/python/hub_pb2.py b/protobuf/python/hub_pb2.py index 2fd81d7..fa09506 100644 --- a/protobuf/python/hub_pb2.py +++ b/protobuf/python/hub_pb2.py @@ -3,6 +3,7 @@ # source: hub.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -14,781 +15,20 @@ _sym_db = _symbol_database.Default() import result_pb2 as result__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='hub.proto', - package='pb', - 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\x0cresult.proto\"\x0e\n\x0c\x45mptyMessage\".\n\rServerMessage\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\t\"N\n\x0cHelloMessage\x12\x0c\n\x04port\x18\x01 \x01(\t\x12\x0c\n\x04host\x18\x02 \x01(\t\x12\"\n\x07servers\x18\x03 \x03(\x0b\x32\x11.pb.ServerMessage\"0\n\x0fInvertibleField\x12\x0e\n\x06invert\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x03(\t\"\x1c\n\x0bStringValue\x12\r\n\x05value\x18\x01 \x01(\t\"\x1a\n\tBoolValue\x12\r\n\x05value\x18\x01 \x01(\x08\"\x1c\n\x0bUInt32Value\x12\r\n\x05value\x18\x01 \x01(\r\"j\n\nRangeField\x12\x1d\n\x02op\x18\x01 \x01(\x0e\x32\x11.pb.RangeField.Op\x12\r\n\x05value\x18\x02 \x03(\x05\".\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\"\xfd\x0b\n\rSearchRequest\x12%\n\x08\x63laim_id\x18\x01 \x01(\x0b\x32\x13.pb.InvertibleField\x12\'\n\nchannel_id\x18\x02 \x01(\x0b\x32\x13.pb.InvertibleField\x12\x0c\n\x04text\x18\x03 \x01(\t\x12\r\n\x05limit\x18\x04 \x01(\x05\x12\x10\n\x08order_by\x18\x05 \x03(\t\x12\x0e\n\x06offset\x18\x06 \x01(\r\x12\x16\n\x0eis_controlling\x18\x07 \x01(\x08\x12\x1d\n\x15last_take_over_height\x18\x08 \x01(\t\x12\x12\n\nclaim_name\x18\t \x01(\t\x12\x17\n\x0fnormalized_name\x18\n \x01(\t\x12#\n\x0btx_position\x18\x0b \x03(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06\x61mount\x18\x0c \x03(\x0b\x32\x0e.pb.RangeField\x12!\n\ttimestamp\x18\r \x03(\x0b\x32\x0e.pb.RangeField\x12*\n\x12\x63reation_timestamp\x18\x0e \x03(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06height\x18\x0f \x03(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0f\x63reation_height\x18\x10 \x03(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x61\x63tivation_height\x18\x11 \x03(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x65xpiration_height\x18\x12 \x03(\x0b\x32\x0e.pb.RangeField\x12$\n\x0crelease_time\x18\x13 \x03(\x0b\x32\x0e.pb.RangeField\x12\x11\n\tshort_url\x18\x14 \x01(\t\x12\x15\n\rcanonical_url\x18\x15 \x01(\t\x12\r\n\x05title\x18\x16 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x17 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x18 \x01(\t\x12\x12\n\nclaim_type\x18\x19 \x03(\t\x12$\n\x0crepost_count\x18\x1a \x03(\x0b\x32\x0e.pb.RangeField\x12\x13\n\x0bstream_type\x18\x1b \x03(\t\x12\x12\n\nmedia_type\x18\x1c \x03(\t\x12\"\n\nfee_amount\x18\x1d \x03(\x0b\x32\x0e.pb.RangeField\x12\x14\n\x0c\x66\x65\x65_currency\x18\x1e \x01(\t\x12 \n\x08\x64uration\x18\x1f \x03(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11reposted_claim_id\x18 \x01(\t\x12#\n\x0b\x63\x65nsor_type\x18! \x03(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11\x63laims_in_channel\x18\" \x01(\t\x12)\n\x12is_signature_valid\x18$ \x01(\x0b\x32\r.pb.BoolValue\x12(\n\x10\x65\x66\x66\x65\x63tive_amount\x18% \x03(\x0b\x32\x0e.pb.RangeField\x12&\n\x0esupport_amount\x18& \x03(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_score\x18\' \x03(\x0b\x32\x0e.pb.RangeField\x12\r\n\x05tx_id\x18+ \x01(\t\x12 \n\x07tx_nout\x18, \x01(\x0b\x32\x0f.pb.UInt32Value\x12\x11\n\tsignature\x18- \x01(\t\x12\x18\n\x10signature_digest\x18. \x01(\t\x12\x18\n\x10public_key_bytes\x18/ \x01(\t\x12\x15\n\rpublic_key_id\x18\x30 \x01(\t\x12\x10\n\x08\x61ny_tags\x18\x31 \x03(\t\x12\x10\n\x08\x61ll_tags\x18\x32 \x03(\t\x12\x10\n\x08not_tags\x18\x33 \x03(\t\x12\x1d\n\x15has_channel_signature\x18\x34 \x01(\x08\x12!\n\nhas_source\x18\x35 \x01(\x0b\x32\r.pb.BoolValue\x12 \n\x18limit_claims_per_channel\x18\x36 \x01(\x05\x12\x15\n\rany_languages\x18\x37 \x03(\t\x12\x15\n\rall_languages\x18\x38 \x03(\t\x12\x19\n\x11remove_duplicates\x18\x39 \x01(\x08\x12\x11\n\tno_totals\x18: \x01(\x08\x32\x88\x03\n\x03Hub\x12*\n\x06Search\x12\x11.pb.SearchRequest\x1a\x0b.pb.Outputs\"\x00\x12+\n\x04Ping\x12\x10.pb.EmptyMessage\x1a\x0f.pb.StringValue\"\x00\x12-\n\x05Hello\x12\x10.pb.HelloMessage\x1a\x10.pb.HelloMessage\"\x00\x12/\n\x07\x41\x64\x64Peer\x12\x11.pb.ServerMessage\x1a\x0f.pb.StringValue\"\x00\x12\x35\n\rPeerSubscribe\x12\x11.pb.ServerMessage\x1a\x0f.pb.StringValue\"\x00\x12.\n\x07Version\x12\x10.pb.EmptyMessage\x1a\x0f.pb.StringValue\"\x00\x12/\n\x08\x46\x65\x61tures\x12\x10.pb.EmptyMessage\x1a\x0f.pb.StringValue\"\x00\x12\x30\n\tBroadcast\x12\x10.pb.EmptyMessage\x1a\x0f.pb.UInt32Value\"\x00\x42&Z$github.com/lbryio/hub/protobuf/go/pbb\x06proto3' - , - dependencies=[result__pb2.DESCRIPTOR,]) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\thub.proto\x12\x02pb\x1a\x0cresult.proto\"\x0e\n\x0c\x45mptyMessage\".\n\rServerMessage\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\t\"N\n\x0cHelloMessage\x12\x0c\n\x04port\x18\x01 \x01(\t\x12\x0c\n\x04host\x18\x02 \x01(\t\x12\"\n\x07servers\x18\x03 \x03(\x0b\x32\x11.pb.ServerMessage\"0\n\x0fInvertibleField\x12\x0e\n\x06invert\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x03(\t\"\x1c\n\x0bStringValue\x12\r\n\x05value\x18\x01 \x01(\t\"\x1a\n\tBoolValue\x12\r\n\x05value\x18\x01 \x01(\x08\"\x1c\n\x0bUInt32Value\x12\r\n\x05value\x18\x01 \x01(\r\"j\n\nRangeField\x12\x1d\n\x02op\x18\x01 \x01(\x0e\x32\x11.pb.RangeField.Op\x12\r\n\x05value\x18\x02 \x03(\x05\".\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\"\xfd\x0b\n\rSearchRequest\x12%\n\x08\x63laim_id\x18\x01 \x01(\x0b\x32\x13.pb.InvertibleField\x12\'\n\nchannel_id\x18\x02 \x01(\x0b\x32\x13.pb.InvertibleField\x12\x0c\n\x04text\x18\x03 \x01(\t\x12\r\n\x05limit\x18\x04 \x01(\x05\x12\x10\n\x08order_by\x18\x05 \x03(\t\x12\x0e\n\x06offset\x18\x06 \x01(\r\x12\x16\n\x0eis_controlling\x18\x07 \x01(\x08\x12\x1d\n\x15last_take_over_height\x18\x08 \x01(\t\x12\x12\n\nclaim_name\x18\t \x01(\t\x12\x17\n\x0fnormalized_name\x18\n \x01(\t\x12#\n\x0btx_position\x18\x0b \x03(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06\x61mount\x18\x0c \x03(\x0b\x32\x0e.pb.RangeField\x12!\n\ttimestamp\x18\r \x03(\x0b\x32\x0e.pb.RangeField\x12*\n\x12\x63reation_timestamp\x18\x0e \x03(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06height\x18\x0f \x03(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0f\x63reation_height\x18\x10 \x03(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x61\x63tivation_height\x18\x11 \x03(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x65xpiration_height\x18\x12 \x03(\x0b\x32\x0e.pb.RangeField\x12$\n\x0crelease_time\x18\x13 \x03(\x0b\x32\x0e.pb.RangeField\x12\x11\n\tshort_url\x18\x14 \x01(\t\x12\x15\n\rcanonical_url\x18\x15 \x01(\t\x12\r\n\x05title\x18\x16 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x17 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x18 \x01(\t\x12\x12\n\nclaim_type\x18\x19 \x03(\t\x12$\n\x0crepost_count\x18\x1a \x03(\x0b\x32\x0e.pb.RangeField\x12\x13\n\x0bstream_type\x18\x1b \x03(\t\x12\x12\n\nmedia_type\x18\x1c \x03(\t\x12\"\n\nfee_amount\x18\x1d \x03(\x0b\x32\x0e.pb.RangeField\x12\x14\n\x0c\x66\x65\x65_currency\x18\x1e \x01(\t\x12 \n\x08\x64uration\x18\x1f \x03(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11reposted_claim_id\x18 \x01(\t\x12#\n\x0b\x63\x65nsor_type\x18! \x03(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11\x63laims_in_channel\x18\" \x01(\t\x12)\n\x12is_signature_valid\x18$ \x01(\x0b\x32\r.pb.BoolValue\x12(\n\x10\x65\x66\x66\x65\x63tive_amount\x18% \x03(\x0b\x32\x0e.pb.RangeField\x12&\n\x0esupport_amount\x18& \x03(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_score\x18\' \x03(\x0b\x32\x0e.pb.RangeField\x12\r\n\x05tx_id\x18+ \x01(\t\x12 \n\x07tx_nout\x18, \x01(\x0b\x32\x0f.pb.UInt32Value\x12\x11\n\tsignature\x18- \x01(\t\x12\x18\n\x10signature_digest\x18. \x01(\t\x12\x18\n\x10public_key_bytes\x18/ \x01(\t\x12\x15\n\rpublic_key_id\x18\x30 \x01(\t\x12\x10\n\x08\x61ny_tags\x18\x31 \x03(\t\x12\x10\n\x08\x61ll_tags\x18\x32 \x03(\t\x12\x10\n\x08not_tags\x18\x33 \x03(\t\x12\x1d\n\x15has_channel_signature\x18\x34 \x01(\x08\x12!\n\nhas_source\x18\x35 \x01(\x0b\x32\r.pb.BoolValue\x12 \n\x18limit_claims_per_channel\x18\x36 \x01(\x05\x12\x15\n\rany_languages\x18\x37 \x03(\t\x12\x15\n\rall_languages\x18\x38 \x03(\t\x12\x19\n\x11remove_duplicates\x18\x39 \x01(\x08\x12\x11\n\tno_totals\x18: \x01(\x08\x32\xb3\x03\n\x03Hub\x12*\n\x06Search\x12\x11.pb.SearchRequest\x1a\x0b.pb.Outputs\"\x00\x12+\n\x04Ping\x12\x10.pb.EmptyMessage\x1a\x0f.pb.StringValue\"\x00\x12-\n\x05Hello\x12\x10.pb.HelloMessage\x1a\x10.pb.HelloMessage\"\x00\x12/\n\x07\x41\x64\x64Peer\x12\x11.pb.ServerMessage\x1a\x0f.pb.StringValue\"\x00\x12\x35\n\rPeerSubscribe\x12\x11.pb.ServerMessage\x1a\x0f.pb.StringValue\"\x00\x12.\n\x07Version\x12\x10.pb.EmptyMessage\x1a\x0f.pb.StringValue\"\x00\x12/\n\x08\x46\x65\x61tures\x12\x10.pb.EmptyMessage\x1a\x0f.pb.StringValue\"\x00\x12\x30\n\tBroadcast\x12\x10.pb.EmptyMessage\x1a\x0f.pb.UInt32Value\"\x00\x12)\n\x07Resolve\x12\x0f.pb.StringValue\x1a\x0b.pb.Outputs\"\x00\x42&Z$github.com/lbryio/hub/protobuf/go/pbb\x06proto3') -_RANGEFIELD_OP = _descriptor.EnumDescriptor( - name='Op', - full_name='pb.RangeField.Op', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='EQ', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LTE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='GTE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LT', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='GT', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=373, - serialized_end=419, -) -_sym_db.RegisterEnumDescriptor(_RANGEFIELD_OP) - - -_EMPTYMESSAGE = _descriptor.Descriptor( - name='EmptyMessage', - full_name='pb.EmptyMessage', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=31, - serialized_end=45, -) - - -_SERVERMESSAGE = _descriptor.Descriptor( - name='ServerMessage', - full_name='pb.ServerMessage', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='pb.ServerMessage.address', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='port', full_name='pb.ServerMessage.port', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=47, - serialized_end=93, -) - - -_HELLOMESSAGE = _descriptor.Descriptor( - name='HelloMessage', - full_name='pb.HelloMessage', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='port', full_name='pb.HelloMessage.port', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='host', full_name='pb.HelloMessage.host', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='servers', full_name='pb.HelloMessage.servers', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=95, - serialized_end=173, -) - - -_INVERTIBLEFIELD = _descriptor.Descriptor( - name='InvertibleField', - full_name='pb.InvertibleField', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='invert', full_name='pb.InvertibleField.invert', index=0, - number=1, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - 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='value', full_name='pb.InvertibleField.value', index=1, - number=2, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=175, - serialized_end=223, -) - - -_STRINGVALUE = _descriptor.Descriptor( - name='StringValue', - full_name='pb.StringValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='value', full_name='pb.StringValue.value', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=225, - serialized_end=253, -) - - -_BOOLVALUE = _descriptor.Descriptor( - name='BoolValue', - full_name='pb.BoolValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='value', full_name='pb.BoolValue.value', index=0, - number=1, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=255, - serialized_end=281, -) - - -_UINT32VALUE = _descriptor.Descriptor( - name='UInt32Value', - full_name='pb.UInt32Value', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='value', full_name='pb.UInt32Value.value', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=283, - serialized_end=311, -) - - -_RANGEFIELD = _descriptor.Descriptor( - name='RangeField', - full_name='pb.RangeField', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='op', full_name='pb.RangeField.op', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - 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='value', full_name='pb.RangeField.value', index=1, - number=2, type=5, cpp_type=1, label=3, - has_default_value=False, default_value=[], - 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=[ - ], - nested_types=[], - enum_types=[ - _RANGEFIELD_OP, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=313, - serialized_end=419, -) - - -_SEARCHREQUEST = _descriptor.Descriptor( - name='SearchRequest', - full_name='pb.SearchRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='claim_id', full_name='pb.SearchRequest.claim_id', index=0, - number=1, 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), - _descriptor.FieldDescriptor( - name='channel_id', full_name='pb.SearchRequest.channel_id', index=1, - number=2, 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), - _descriptor.FieldDescriptor( - name='text', full_name='pb.SearchRequest.text', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='limit', full_name='pb.SearchRequest.limit', index=3, - number=4, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - 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='order_by', full_name='pb.SearchRequest.order_by', index=4, - number=5, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='offset', full_name='pb.SearchRequest.offset', index=5, - number=6, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='is_controlling', full_name='pb.SearchRequest.is_controlling', index=6, - number=7, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - 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='last_take_over_height', full_name='pb.SearchRequest.last_take_over_height', index=7, - number=8, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='claim_name', full_name='pb.SearchRequest.claim_name', index=8, - number=9, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='normalized_name', full_name='pb.SearchRequest.normalized_name', index=9, - number=10, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='tx_position', full_name='pb.SearchRequest.tx_position', index=10, - number=11, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='amount', full_name='pb.SearchRequest.amount', index=11, - number=12, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='timestamp', full_name='pb.SearchRequest.timestamp', index=12, - number=13, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='creation_timestamp', full_name='pb.SearchRequest.creation_timestamp', index=13, - number=14, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='height', full_name='pb.SearchRequest.height', index=14, - number=15, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='creation_height', full_name='pb.SearchRequest.creation_height', index=15, - number=16, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='activation_height', full_name='pb.SearchRequest.activation_height', index=16, - number=17, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='expiration_height', full_name='pb.SearchRequest.expiration_height', index=17, - number=18, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='release_time', full_name='pb.SearchRequest.release_time', index=18, - number=19, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='short_url', full_name='pb.SearchRequest.short_url', index=19, - number=20, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='canonical_url', full_name='pb.SearchRequest.canonical_url', index=20, - number=21, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='title', full_name='pb.SearchRequest.title', index=21, - number=22, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='author', full_name='pb.SearchRequest.author', index=22, - number=23, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='description', full_name='pb.SearchRequest.description', index=23, - number=24, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='claim_type', full_name='pb.SearchRequest.claim_type', index=24, - number=25, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='repost_count', full_name='pb.SearchRequest.repost_count', index=25, - number=26, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='stream_type', full_name='pb.SearchRequest.stream_type', index=26, - number=27, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='media_type', full_name='pb.SearchRequest.media_type', index=27, - number=28, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='fee_amount', full_name='pb.SearchRequest.fee_amount', index=28, - number=29, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='fee_currency', full_name='pb.SearchRequest.fee_currency', index=29, - number=30, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='duration', full_name='pb.SearchRequest.duration', index=30, - number=31, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='reposted_claim_id', full_name='pb.SearchRequest.reposted_claim_id', index=31, - number=32, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='censor_type', full_name='pb.SearchRequest.censor_type', index=32, - number=33, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='claims_in_channel', full_name='pb.SearchRequest.claims_in_channel', index=33, - number=34, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='is_signature_valid', full_name='pb.SearchRequest.is_signature_valid', index=34, - number=36, 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), - _descriptor.FieldDescriptor( - name='effective_amount', full_name='pb.SearchRequest.effective_amount', index=35, - number=37, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='support_amount', full_name='pb.SearchRequest.support_amount', index=36, - number=38, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='trending_score', full_name='pb.SearchRequest.trending_score', index=37, - number=39, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='tx_id', full_name='pb.SearchRequest.tx_id', index=38, - number=43, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='tx_nout', full_name='pb.SearchRequest.tx_nout', index=39, - number=44, 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), - _descriptor.FieldDescriptor( - name='signature', full_name='pb.SearchRequest.signature', index=40, - number=45, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='signature_digest', full_name='pb.SearchRequest.signature_digest', index=41, - number=46, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='public_key_bytes', full_name='pb.SearchRequest.public_key_bytes', index=42, - number=47, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='public_key_id', full_name='pb.SearchRequest.public_key_id', index=43, - number=48, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='any_tags', full_name='pb.SearchRequest.any_tags', index=44, - number=49, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='all_tags', full_name='pb.SearchRequest.all_tags', index=45, - number=50, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='not_tags', full_name='pb.SearchRequest.not_tags', index=46, - number=51, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='has_channel_signature', full_name='pb.SearchRequest.has_channel_signature', index=47, - number=52, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - 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='has_source', full_name='pb.SearchRequest.has_source', index=48, - number=53, 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), - _descriptor.FieldDescriptor( - name='limit_claims_per_channel', full_name='pb.SearchRequest.limit_claims_per_channel', index=49, - number=54, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - 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='any_languages', full_name='pb.SearchRequest.any_languages', index=50, - number=55, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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='all_languages', full_name='pb.SearchRequest.all_languages', index=51, - number=56, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - 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=52, - number=57, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - 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='no_totals', full_name='pb.SearchRequest.no_totals', index=53, - number=58, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=422, - serialized_end=1955, -) - -_HELLOMESSAGE.fields_by_name['servers'].message_type = _SERVERMESSAGE -_RANGEFIELD.fields_by_name['op'].enum_type = _RANGEFIELD_OP -_RANGEFIELD_OP.containing_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['claim_id'].message_type = _INVERTIBLEFIELD -_SEARCHREQUEST.fields_by_name['channel_id'].message_type = _INVERTIBLEFIELD -_SEARCHREQUEST.fields_by_name['tx_position'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['amount'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['timestamp'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['creation_timestamp'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['height'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['creation_height'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['activation_height'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['expiration_height'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['release_time'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['repost_count'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['fee_amount'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['duration'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['censor_type'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['is_signature_valid'].message_type = _BOOLVALUE -_SEARCHREQUEST.fields_by_name['effective_amount'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['support_amount'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['trending_score'].message_type = _RANGEFIELD -_SEARCHREQUEST.fields_by_name['tx_nout'].message_type = _UINT32VALUE -_SEARCHREQUEST.fields_by_name['has_source'].message_type = _BOOLVALUE -DESCRIPTOR.message_types_by_name['EmptyMessage'] = _EMPTYMESSAGE -DESCRIPTOR.message_types_by_name['ServerMessage'] = _SERVERMESSAGE -DESCRIPTOR.message_types_by_name['HelloMessage'] = _HELLOMESSAGE -DESCRIPTOR.message_types_by_name['InvertibleField'] = _INVERTIBLEFIELD -DESCRIPTOR.message_types_by_name['StringValue'] = _STRINGVALUE -DESCRIPTOR.message_types_by_name['BoolValue'] = _BOOLVALUE -DESCRIPTOR.message_types_by_name['UInt32Value'] = _UINT32VALUE -DESCRIPTOR.message_types_by_name['RangeField'] = _RANGEFIELD -DESCRIPTOR.message_types_by_name['SearchRequest'] = _SEARCHREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_EMPTYMESSAGE = DESCRIPTOR.message_types_by_name['EmptyMessage'] +_SERVERMESSAGE = DESCRIPTOR.message_types_by_name['ServerMessage'] +_HELLOMESSAGE = DESCRIPTOR.message_types_by_name['HelloMessage'] +_INVERTIBLEFIELD = DESCRIPTOR.message_types_by_name['InvertibleField'] +_STRINGVALUE = DESCRIPTOR.message_types_by_name['StringValue'] +_BOOLVALUE = DESCRIPTOR.message_types_by_name['BoolValue'] +_UINT32VALUE = DESCRIPTOR.message_types_by_name['UInt32Value'] +_RANGEFIELD = DESCRIPTOR.message_types_by_name['RangeField'] +_SEARCHREQUEST = DESCRIPTOR.message_types_by_name['SearchRequest'] +_RANGEFIELD_OP = _RANGEFIELD.enum_types_by_name['Op'] EmptyMessage = _reflection.GeneratedProtocolMessageType('EmptyMessage', (_message.Message,), { 'DESCRIPTOR' : _EMPTYMESSAGE, '__module__' : 'hub_pb2' @@ -852,102 +92,31 @@ SearchRequest = _reflection.GeneratedProtocolMessageType('SearchRequest', (_mess }) _sym_db.RegisterMessage(SearchRequest) +_HUB = DESCRIPTOR.services_by_name['Hub'] +if _descriptor._USE_C_DESCRIPTORS == False: -DESCRIPTOR._options = None - -_HUB = _descriptor.ServiceDescriptor( - name='Hub', - full_name='pb.Hub', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=1958, - serialized_end=2350, - methods=[ - _descriptor.MethodDescriptor( - name='Search', - full_name='pb.Hub.Search', - index=0, - containing_service=None, - input_type=_SEARCHREQUEST, - output_type=result__pb2._OUTPUTS, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='Ping', - full_name='pb.Hub.Ping', - index=1, - containing_service=None, - input_type=_EMPTYMESSAGE, - output_type=_STRINGVALUE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='Hello', - full_name='pb.Hub.Hello', - index=2, - containing_service=None, - input_type=_HELLOMESSAGE, - output_type=_HELLOMESSAGE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='AddPeer', - full_name='pb.Hub.AddPeer', - index=3, - containing_service=None, - input_type=_SERVERMESSAGE, - output_type=_STRINGVALUE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='PeerSubscribe', - full_name='pb.Hub.PeerSubscribe', - index=4, - containing_service=None, - input_type=_SERVERMESSAGE, - output_type=_STRINGVALUE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='Version', - full_name='pb.Hub.Version', - index=5, - containing_service=None, - input_type=_EMPTYMESSAGE, - output_type=_STRINGVALUE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='Features', - full_name='pb.Hub.Features', - index=6, - containing_service=None, - input_type=_EMPTYMESSAGE, - output_type=_STRINGVALUE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='Broadcast', - full_name='pb.Hub.Broadcast', - index=7, - containing_service=None, - input_type=_EMPTYMESSAGE, - output_type=_UINT32VALUE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_HUB) - -DESCRIPTOR.services_by_name['Hub'] = _HUB - + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'Z$github.com/lbryio/hub/protobuf/go/pb' + _EMPTYMESSAGE._serialized_start=31 + _EMPTYMESSAGE._serialized_end=45 + _SERVERMESSAGE._serialized_start=47 + _SERVERMESSAGE._serialized_end=93 + _HELLOMESSAGE._serialized_start=95 + _HELLOMESSAGE._serialized_end=173 + _INVERTIBLEFIELD._serialized_start=175 + _INVERTIBLEFIELD._serialized_end=223 + _STRINGVALUE._serialized_start=225 + _STRINGVALUE._serialized_end=253 + _BOOLVALUE._serialized_start=255 + _BOOLVALUE._serialized_end=281 + _UINT32VALUE._serialized_start=283 + _UINT32VALUE._serialized_end=311 + _RANGEFIELD._serialized_start=313 + _RANGEFIELD._serialized_end=419 + _RANGEFIELD_OP._serialized_start=373 + _RANGEFIELD_OP._serialized_end=419 + _SEARCHREQUEST._serialized_start=422 + _SEARCHREQUEST._serialized_end=1955 + _HUB._serialized_start=1958 + _HUB._serialized_end=2393 # @@protoc_insertion_point(module_scope) diff --git a/protobuf/python/hub_pb2_grpc.py b/protobuf/python/hub_pb2_grpc.py index d64c164..2e5d5d2 100644 --- a/protobuf/python/hub_pb2_grpc.py +++ b/protobuf/python/hub_pb2_grpc.py @@ -55,6 +55,11 @@ class HubStub(object): request_serializer=hub__pb2.EmptyMessage.SerializeToString, response_deserializer=hub__pb2.UInt32Value.FromString, ) + self.Resolve = channel.unary_unary( + '/pb.Hub/Resolve', + request_serializer=hub__pb2.StringValue.SerializeToString, + response_deserializer=result__pb2.Outputs.FromString, + ) class HubServicer(object): @@ -108,6 +113,12 @@ class HubServicer(object): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def Resolve(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def add_HubServicer_to_server(servicer, server): rpc_method_handlers = { @@ -151,6 +162,11 @@ def add_HubServicer_to_server(servicer, server): request_deserializer=hub__pb2.EmptyMessage.FromString, response_serializer=hub__pb2.UInt32Value.SerializeToString, ), + 'Resolve': grpc.unary_unary_rpc_method_handler( + servicer.Resolve, + request_deserializer=hub__pb2.StringValue.FromString, + response_serializer=result__pb2.Outputs.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( 'pb.Hub', rpc_method_handlers) @@ -296,3 +312,20 @@ class Hub(object): hub__pb2.UInt32Value.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def Resolve(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/pb.Hub/Resolve', + hub__pb2.StringValue.SerializeToString, + result__pb2.Outputs.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/protobuf/python/result_pb2.py b/protobuf/python/result_pb2.py index be36eef..edb219e 100644 --- a/protobuf/python/result_pb2.py +++ b/protobuf/python/result_pb2.py @@ -3,6 +3,7 @@ # source: result.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -13,417 +14,16 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor.FileDescriptor( - name='result.proto', - package='pb', - syntax='proto3', - serialized_options=b'Z$github.com/lbryio/hub/protobuf/go/pb', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x0cresult.proto\x12\x02pb\"\x97\x01\n\x07Outputs\x12\x18\n\x04txos\x18\x01 \x03(\x0b\x32\n.pb.Output\x12\x1e\n\nextra_txos\x18\x02 \x03(\x0b\x32\n.pb.Output\x12\r\n\x05total\x18\x03 \x01(\r\x12\x0e\n\x06offset\x18\x04 \x01(\r\x12\x1c\n\x07\x62locked\x18\x05 \x03(\x0b\x32\x0b.pb.Blocked\x12\x15\n\rblocked_total\x18\x06 \x01(\r\"{\n\x06Output\x12\x0f\n\x07tx_hash\x18\x01 \x01(\x0c\x12\x0c\n\x04nout\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x1e\n\x05\x63laim\x18\x07 \x01(\x0b\x32\r.pb.ClaimMetaH\x00\x12\x1a\n\x05\x65rror\x18\x0f \x01(\x0b\x32\t.pb.ErrorH\x00\x42\x06\n\x04meta\"\xe6\x02\n\tClaimMeta\x12\x1b\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\n.pb.Output\x12\x1a\n\x06repost\x18\x02 \x01(\x0b\x32\n.pb.Output\x12\x11\n\tshort_url\x18\x03 \x01(\t\x12\x15\n\rcanonical_url\x18\x04 \x01(\t\x12\x16\n\x0eis_controlling\x18\x05 \x01(\x08\x12\x18\n\x10take_over_height\x18\x06 \x01(\r\x12\x17\n\x0f\x63reation_height\x18\x07 \x01(\r\x12\x19\n\x11\x61\x63tivation_height\x18\x08 \x01(\r\x12\x19\n\x11\x65xpiration_height\x18\t \x01(\r\x12\x19\n\x11\x63laims_in_channel\x18\n \x01(\r\x12\x10\n\x08reposted\x18\x0b \x01(\r\x12\x18\n\x10\x65\x66\x66\x65\x63tive_amount\x18\x14 \x01(\x04\x12\x16\n\x0esupport_amount\x18\x15 \x01(\x04\x12\x16\n\x0etrending_score\x18\x16 \x01(\x01\"\x94\x01\n\x05\x45rror\x12\x1c\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0e.pb.Error.Code\x12\x0c\n\x04text\x18\x02 \x01(\t\x12\x1c\n\x07\x62locked\x18\x03 \x01(\x0b\x32\x0b.pb.Blocked\"A\n\x04\x43ode\x12\x10\n\x0cUNKNOWN_CODE\x10\x00\x12\r\n\tNOT_FOUND\x10\x01\x12\x0b\n\x07INVALID\x10\x02\x12\x0b\n\x07\x42LOCKED\x10\x03\"5\n\x07\x42locked\x12\r\n\x05\x63ount\x18\x01 \x01(\r\x12\x1b\n\x07\x63hannel\x18\x02 \x01(\x0b\x32\n.pb.OutputB&Z$github.com/lbryio/hub/protobuf/go/pbb\x06proto3' -) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cresult.proto\x12\x02pb\"\x97\x01\n\x07Outputs\x12\x18\n\x04txos\x18\x01 \x03(\x0b\x32\n.pb.Output\x12\x1e\n\nextra_txos\x18\x02 \x03(\x0b\x32\n.pb.Output\x12\r\n\x05total\x18\x03 \x01(\r\x12\x0e\n\x06offset\x18\x04 \x01(\r\x12\x1c\n\x07\x62locked\x18\x05 \x03(\x0b\x32\x0b.pb.Blocked\x12\x15\n\rblocked_total\x18\x06 \x01(\r\"{\n\x06Output\x12\x0f\n\x07tx_hash\x18\x01 \x01(\x0c\x12\x0c\n\x04nout\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x1e\n\x05\x63laim\x18\x07 \x01(\x0b\x32\r.pb.ClaimMetaH\x00\x12\x1a\n\x05\x65rror\x18\x0f \x01(\x0b\x32\t.pb.ErrorH\x00\x42\x06\n\x04meta\"\xe6\x02\n\tClaimMeta\x12\x1b\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\n.pb.Output\x12\x1a\n\x06repost\x18\x02 \x01(\x0b\x32\n.pb.Output\x12\x11\n\tshort_url\x18\x03 \x01(\t\x12\x15\n\rcanonical_url\x18\x04 \x01(\t\x12\x16\n\x0eis_controlling\x18\x05 \x01(\x08\x12\x18\n\x10take_over_height\x18\x06 \x01(\r\x12\x17\n\x0f\x63reation_height\x18\x07 \x01(\r\x12\x19\n\x11\x61\x63tivation_height\x18\x08 \x01(\r\x12\x19\n\x11\x65xpiration_height\x18\t \x01(\r\x12\x19\n\x11\x63laims_in_channel\x18\n \x01(\r\x12\x10\n\x08reposted\x18\x0b \x01(\r\x12\x18\n\x10\x65\x66\x66\x65\x63tive_amount\x18\x14 \x01(\x04\x12\x16\n\x0esupport_amount\x18\x15 \x01(\x04\x12\x16\n\x0etrending_score\x18\x16 \x01(\x01\"\x94\x01\n\x05\x45rror\x12\x1c\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0e.pb.Error.Code\x12\x0c\n\x04text\x18\x02 \x01(\t\x12\x1c\n\x07\x62locked\x18\x03 \x01(\x0b\x32\x0b.pb.Blocked\"A\n\x04\x43ode\x12\x10\n\x0cUNKNOWN_CODE\x10\x00\x12\r\n\tNOT_FOUND\x10\x01\x12\x0b\n\x07INVALID\x10\x02\x12\x0b\n\x07\x42LOCKED\x10\x03\"5\n\x07\x42locked\x12\r\n\x05\x63ount\x18\x01 \x01(\r\x12\x1b\n\x07\x63hannel\x18\x02 \x01(\x0b\x32\n.pb.OutputB&Z$github.com/lbryio/hub/protobuf/go/pbb\x06proto3') -_ERROR_CODE = _descriptor.EnumDescriptor( - name='Code', - full_name='pb.Error.Code', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='UNKNOWN_CODE', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='NOT_FOUND', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='INVALID', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='BLOCKED', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=744, - serialized_end=809, -) -_sym_db.RegisterEnumDescriptor(_ERROR_CODE) - - -_OUTPUTS = _descriptor.Descriptor( - name='Outputs', - full_name='pb.Outputs', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='txos', full_name='pb.Outputs.txos', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='extra_txos', full_name='pb.Outputs.extra_txos', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='total', full_name='pb.Outputs.total', index=2, - number=3, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='offset', full_name='pb.Outputs.offset', index=3, - number=4, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='blocked', full_name='pb.Outputs.blocked', index=4, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - 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='blocked_total', full_name='pb.Outputs.blocked_total', index=5, - number=6, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=21, - serialized_end=172, -) - - -_OUTPUT = _descriptor.Descriptor( - name='Output', - full_name='pb.Output', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='tx_hash', full_name='pb.Output.tx_hash', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - 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='nout', full_name='pb.Output.nout', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='height', full_name='pb.Output.height', index=2, - number=3, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='claim', full_name='pb.Output.claim', index=3, - number=7, 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), - _descriptor.FieldDescriptor( - name='error', full_name='pb.Output.error', index=4, - number=15, 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='meta', full_name='pb.Output.meta', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=174, - serialized_end=297, -) - - -_CLAIMMETA = _descriptor.Descriptor( - name='ClaimMeta', - full_name='pb.ClaimMeta', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='channel', full_name='pb.ClaimMeta.channel', index=0, - number=1, 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), - _descriptor.FieldDescriptor( - name='repost', full_name='pb.ClaimMeta.repost', index=1, - number=2, 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), - _descriptor.FieldDescriptor( - name='short_url', full_name='pb.ClaimMeta.short_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='canonical_url', full_name='pb.ClaimMeta.canonical_url', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='is_controlling', full_name='pb.ClaimMeta.is_controlling', index=4, - number=5, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - 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='take_over_height', full_name='pb.ClaimMeta.take_over_height', index=5, - number=6, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='creation_height', full_name='pb.ClaimMeta.creation_height', index=6, - number=7, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='activation_height', full_name='pb.ClaimMeta.activation_height', index=7, - number=8, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='expiration_height', full_name='pb.ClaimMeta.expiration_height', index=8, - number=9, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='claims_in_channel', full_name='pb.ClaimMeta.claims_in_channel', index=9, - number=10, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='reposted', full_name='pb.ClaimMeta.reposted', index=10, - number=11, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='effective_amount', full_name='pb.ClaimMeta.effective_amount', index=11, - number=20, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - 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='support_amount', full_name='pb.ClaimMeta.support_amount', index=12, - number=21, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - 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='trending_score', full_name='pb.ClaimMeta.trending_score', index=13, - number=22, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=300, - serialized_end=658, -) - - -_ERROR = _descriptor.Descriptor( - name='Error', - full_name='pb.Error', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='code', full_name='pb.Error.code', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - 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='text', full_name='pb.Error.text', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='blocked', full_name='pb.Error.blocked', index=2, - number=3, 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=[ - ], - nested_types=[], - enum_types=[ - _ERROR_CODE, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=661, - serialized_end=809, -) - - -_BLOCKED = _descriptor.Descriptor( - name='Blocked', - full_name='pb.Blocked', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='count', full_name='pb.Blocked.count', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - 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='channel', full_name='pb.Blocked.channel', index=1, - number=2, 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=811, - serialized_end=864, -) - -_OUTPUTS.fields_by_name['txos'].message_type = _OUTPUT -_OUTPUTS.fields_by_name['extra_txos'].message_type = _OUTPUT -_OUTPUTS.fields_by_name['blocked'].message_type = _BLOCKED -_OUTPUT.fields_by_name['claim'].message_type = _CLAIMMETA -_OUTPUT.fields_by_name['error'].message_type = _ERROR -_OUTPUT.oneofs_by_name['meta'].fields.append( - _OUTPUT.fields_by_name['claim']) -_OUTPUT.fields_by_name['claim'].containing_oneof = _OUTPUT.oneofs_by_name['meta'] -_OUTPUT.oneofs_by_name['meta'].fields.append( - _OUTPUT.fields_by_name['error']) -_OUTPUT.fields_by_name['error'].containing_oneof = _OUTPUT.oneofs_by_name['meta'] -_CLAIMMETA.fields_by_name['channel'].message_type = _OUTPUT -_CLAIMMETA.fields_by_name['repost'].message_type = _OUTPUT -_ERROR.fields_by_name['code'].enum_type = _ERROR_CODE -_ERROR.fields_by_name['blocked'].message_type = _BLOCKED -_ERROR_CODE.containing_type = _ERROR -_BLOCKED.fields_by_name['channel'].message_type = _OUTPUT -DESCRIPTOR.message_types_by_name['Outputs'] = _OUTPUTS -DESCRIPTOR.message_types_by_name['Output'] = _OUTPUT -DESCRIPTOR.message_types_by_name['ClaimMeta'] = _CLAIMMETA -DESCRIPTOR.message_types_by_name['Error'] = _ERROR -DESCRIPTOR.message_types_by_name['Blocked'] = _BLOCKED -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_OUTPUTS = DESCRIPTOR.message_types_by_name['Outputs'] +_OUTPUT = DESCRIPTOR.message_types_by_name['Output'] +_CLAIMMETA = DESCRIPTOR.message_types_by_name['ClaimMeta'] +_ERROR = DESCRIPTOR.message_types_by_name['Error'] +_BLOCKED = DESCRIPTOR.message_types_by_name['Blocked'] +_ERROR_CODE = _ERROR.enum_types_by_name['Code'] Outputs = _reflection.GeneratedProtocolMessageType('Outputs', (_message.Message,), { 'DESCRIPTOR' : _OUTPUTS, '__module__' : 'result_pb2' @@ -459,6 +59,20 @@ Blocked = _reflection.GeneratedProtocolMessageType('Blocked', (_message.Message, }) _sym_db.RegisterMessage(Blocked) +if _descriptor._USE_C_DESCRIPTORS == False: -DESCRIPTOR._options = None + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'Z$github.com/lbryio/hub/protobuf/go/pb' + _OUTPUTS._serialized_start=21 + _OUTPUTS._serialized_end=172 + _OUTPUT._serialized_start=174 + _OUTPUT._serialized_end=297 + _CLAIMMETA._serialized_start=300 + _CLAIMMETA._serialized_end=658 + _ERROR._serialized_start=661 + _ERROR._serialized_end=809 + _ERROR_CODE._serialized_start=744 + _ERROR_CODE._serialized_end=809 + _BLOCKED._serialized_start=811 + _BLOCKED._serialized_end=864 # @@protoc_insertion_point(module_scope) diff --git a/server/server.go b/server/server.go index 8a01f9f..f6deb7b 100644 --- a/server/server.go +++ b/server/server.go @@ -329,3 +329,165 @@ func (s *Server) Version(ctx context.Context, args *pb.EmptyMessage) (*pb.String metrics.RequestsCount.With(prometheus.Labels{"method": "version"}).Inc() return &pb.StringValue{Value: getVersion()}, nil } + +/* + async def claimtrie_resolve(self, *urls) -> str: + sorted_urls = tuple(sorted(urls)) + self.session_manager.urls_to_resolve_count_metric.inc(len(sorted_urls)) + try: + if sorted_urls in self.session_manager.resolve_outputs_cache: + return self.session_manager.resolve_outputs_cache[sorted_urls] + rows, extra = [], [] + for url in urls: + if url not in self.session_manager.resolve_cache: + self.session_manager.resolve_cache[url] = await self._cached_resolve_url(url) + stream, channel, repost, reposted_channel = self.session_manager.resolve_cache[url] + if isinstance(channel, ResolveCensoredError): + rows.append(channel) + extra.append(channel.censor_row) + elif isinstance(stream, ResolveCensoredError): + rows.append(stream) + extra.append(stream.censor_row) + elif channel and not stream: + rows.append(channel) + # print("resolved channel", channel.name.decode()) + if repost: + extra.append(repost) + if reposted_channel: + extra.append(reposted_channel) + elif stream: + # print("resolved stream", stream.name.decode()) + rows.append(stream) + if channel: + # print("and channel", channel.name.decode()) + extra.append(channel) + if repost: + extra.append(repost) + if reposted_channel: + extra.append(reposted_channel) + await asyncio.sleep(0) + self.session_manager.resolve_outputs_cache[sorted_urls] = result = await self.loop.run_in_executor( + None, Outputs.to_base64, rows, extra, 0, None, None + ) + return result + finally: + self.session_manager.resolved_url_count_metric.inc(len(sorted_urls)) +*/ + +func ResolveResultToOutput(res *db.ResolveResult) *pb.Output { + claimMeta := &pb.ClaimMeta{ + ShortUrl: res.ShortUrl, + Reposted: uint32(res.Reposted), + IsControlling: res.IsControlling, + CreationHeight: res.CreationHeight, + ExpirationHeight: res.ExpirationHeight, + EffectiveAmount: res.EffectiveAmount, + SupportAmount: res.SupportAmount, + } + + claim := &pb.Output_Claim{ + Claim: claimMeta, + } + + output := &pb.Output{ + TxHash: res.TxHash, + Nout: uint32(res.Position), + Height: res.Height, + Meta: claim, + } + + return output +} + +func ExpandedResolveResultToOutput(res *db.ExpandedResolveResult) ([]*pb.Output, []*pb.Output, error) { + // FIXME: figure out the handling of rows and extra properly + // FIXME: want to return empty list or nil when extraTxos is empty? + txos := make([]*pb.Output, 0) + extraTxos := make([]*pb.Output, 0) + // Errors + if x := res.Channel.GetError(); x != nil { + outputErr := &pb.Output_Error{ + Error: &pb.Error{ + Text: x.Error.Error(), + Code: 0, //FIXME + }, + } + res := &pb.Output{Meta: outputErr} + txos = append(txos, res) + return txos, nil, nil + } + if x := res.Stream.GetError(); x != nil { + outputErr := &pb.Output_Error{ + Error: &pb.Error{ + Text: x.Error.Error(), + Code: 0, //FIXME + }, + } + res := &pb.Output{Meta: outputErr} + txos = append(txos, res) + return txos, nil, nil + } + + // Not errors + var channel, stream, repost, repostedChannel *db.ResolveResult + + channel = res.Channel.GetResult() + stream = res.Stream.GetResult() + repost = res.Repost.GetResult() + repostedChannel = res.RepostedChannel.GetResult() + + if channel != nil && stream == nil { + // Channel + output := ResolveResultToOutput(channel) + txos = append(txos, output) + + if repost != nil { + output := ResolveResultToOutput(repost) + extraTxos = append(extraTxos, output) + } + if repostedChannel != nil { + output := ResolveResultToOutput(repostedChannel) + extraTxos = append(extraTxos, output) + } + + return txos, extraTxos, nil + } else if stream != nil { + output := ResolveResultToOutput(channel) + txos = append(txos, output) + if channel != nil { + output := ResolveResultToOutput(stream) + extraTxos = append(extraTxos, output) + } + if repost != nil { + output := ResolveResultToOutput(repost) + extraTxos = append(extraTxos, output) + } + if repostedChannel != nil { + output := ResolveResultToOutput(repostedChannel) + extraTxos = append(extraTxos, output) + } + + return txos, extraTxos, nil + } + + return nil, nil, nil +} + +func (s *Server) Resolve(ctx context.Context, args *pb.StringValue) (*pb.Outputs, error) { + metrics.RequestsCount.With(prometheus.Labels{"method": "resolve"}).Inc() + + res := db.Resolve(s.DB, args.Value) + txos, extraTxos, err := ExpandedResolveResultToOutput(res) + if err != nil { + return nil, err + } + + return &pb.Outputs{ + Txos: txos, + ExtraTxos: extraTxos, + Total: 1, + Offset: 0, + Blocked: nil, + BlockedTotal: 0, + }, nil +}