proto fixes and cleanup

This commit is contained in:
Jeffrey Picard 2021-09-18 13:21:32 -04:00
parent 81c3de3bfd
commit fdbd7ec509
10 changed files with 361 additions and 1384 deletions

3
go.mod
View file

@ -5,12 +5,9 @@ go 1.16
require (
github.com/akamensky/argparse v1.2.2
github.com/btcsuite/btcutil v1.0.2
github.com/go-zeromq/zmq4 v0.13.0
github.com/golang/protobuf v1.5.2
github.com/lbryio/lbry.go/v2 v2.7.2-0.20210625145058-2b155597bf57
github.com/olivere/elastic/v7 v7.0.24
github.com/prometheus/client_golang v1.11.0
github.com/ybbus/jsonrpc/v2 v2.1.6
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
golang.org/x/text v0.3.6
google.golang.org/genproto v0.0.0-20210524171403-669157292da3 // indirect

11
go.sum
View file

@ -59,10 +59,6 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-zeromq/goczmq/v4 v4.2.2 h1:HAJN+i+3NW55ijMJJhk7oWxHKXgAuSBkoFfvr8bYj4U=
github.com/go-zeromq/goczmq/v4 v4.2.2/go.mod h1:Sm/lxrfxP/Oxqs0tnHD6WAhwkWrx+S+1MRrKzcxoaYE=
github.com/go-zeromq/zmq4 v0.13.0 h1:XUWXLyeRsPsv4KlKMXnv/cEm//Vew2RLuNmDFQnZQXU=
github.com/go-zeromq/zmq4 v0.13.0/go.mod h1:TrFwdPHMSLG7Rhp8OVhQBkb4bSajfucWv8rwoEFIgSY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@ -146,8 +142,6 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@ -198,10 +192,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/ybbus/jsonrpc v0.0.0-20180411222309-2a548b7d822d h1:tQo6hjclyv3RHUgZOl6iWb2Y44A/sN9bf9LAYfuioEg=
github.com/ybbus/jsonrpc v0.0.0-20180411222309-2a548b7d822d/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE=
github.com/ybbus/jsonrpc/v2 v2.1.6 h1:++pboiaaD6TZ9FJ1JOBBRB/tPtR1njYzqz1iSZGv+3Y=
github.com/ybbus/jsonrpc/v2 v2.1.6/go.mod h1:rIuG1+ORoiqocf9xs/v+ecaAVeo3zcZHQgInyKFMeg0=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
@ -244,7 +235,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -333,7 +323,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

10
main.go
View file

@ -57,7 +57,7 @@ func makeServeCmd(parser *argparse.Parser) *argparse.Command {
}
*/
func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *server.Args {
func parseArgs(searchRequest *pb.SearchRequest) *server.Args {
environment := GetEnvironmentStandard()
parser := argparse.NewParser("hub", "hub server and client")
@ -82,8 +82,6 @@ func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *serv
channelId := parser.String("", "channel_id", &argparse.Options{Required: false, Help: "channel id"})
channelIds := parser.StringList("", "channel_ids", &argparse.Options{Required: false, Help: "channel ids"})
hash := parser.String("", "hash", &argparse.Options{Required: false, Help: "block hash"})
// Now parse the arguments
err := parser.Parse(os.Args)
if err != nil {
@ -153,9 +151,6 @@ func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *serv
searchRequest.ChannelId = &pb.InvertibleField{Invert: false, Value: *channelIds}
}
if *hash != "" {
blockReq.Blockhash = *hash
}
return args
}
@ -163,9 +158,8 @@ func parseArgs(searchRequest *pb.SearchRequest, blockReq *pb.BlockRequest) *serv
func main() {
searchRequest := &pb.SearchRequest{}
blockReq := &pb.BlockRequest{}
args := parseArgs(searchRequest, blockReq)
args := parseArgs(searchRequest)
if args.CmdType == server.ServeCmd {

View file

@ -6,16 +6,11 @@ import "result.proto";
package pb;
service Hub {
rpc SubscribeHeaders (BlockRequest) returns (stream BlockHeaderOutput) {}
rpc Search (SearchRequest) returns (Outputs) {}
rpc GetBlock (BlockRequest) returns (BlockOutput) {}
rpc GetBlockHeader (BlockRequest) returns (BlockHeaderOutput) {}
rpc GetServerHeight (EmptyMessage) returns (google.protobuf.UInt64Value) {}
rpc GetHeaders (BlockRequest) returns (stream BlockHeaderOutput) {}
rpc Ping (EmptyMessage) returns (google.protobuf.StringValue) {}
rpc Version (EmptyMessage) returns (google.protobuf.StringValue) {}
rpc Features (EmptyMessage) returns (google.protobuf.StringValue) {}
rpc Broadcast(EmptyMessage) returns (google.protobuf.UInt64Value) {}
rpc Ping (EmptyMessage) returns (StringValue) {}
rpc Version (EmptyMessage) returns (StringValue) {}
rpc Features (EmptyMessage) returns (StringValue) {}
rpc Broadcast(EmptyMessage) returns (UInt32Value) {}
}
message EmptyMessage {}
@ -25,6 +20,10 @@ message InvertibleField {
repeated string value = 2;
}
message StringValue {
string value = 1;
}
message BoolValue {
bool value = 1;
}

View file

@ -59,45 +59,4 @@ message Error {
message Blocked {
uint32 count = 1;
Output channel = 2;
}
message BlockOutput {
string hash = 1;
int32 confirmations = 2;
}
/*
{ (json object)
"hash" : "hex", (string) the block hash (same as provided)
"confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain
"height" : n, (numeric) The block height or index
"version" : n, (numeric) The block version
"versionHex" : "hex", (string) The block version formatted in hexadecimal
"merkleroot" : "hex", (string) The merkle root
"time" : xxx, (numeric) The block time expressed in UNIX epoch time
"mediantime" : xxx, (numeric) The median block time expressed in UNIX epoch time
"nonce" : n, (numeric) The nonce
"bits" : "hex", (string) The bits
"difficulty" : n, (numeric) The difficulty
"chainwork" : "hex", (string) Expected number of hashes required to produce the current chain
"nTx" : n, (numeric) The number of transactions in the block
"previousblockhash" : "hex", (string) The hash of the previous block
"nextblockhash" : "hex" (string) The hash of the next block
}
*/
message BlockHeaderOutput {
string hash = 1;
int64 confirmations = 2;
int64 height = 3;
int64 version = 4;
string versionHex = 5;
string merkleroot = 6;
int64 time = 7;
int64 mediantime = 8;
int64 nonce = 9;
string bits = 10;
double difficulty = 11;
string chainwork = 12;
int64 nTx = 13;
string previousblockhash = 14;
string nextblockhash = 15;
}

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,6 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)
// This is a compile-time assertion to ensure that this generated file
@ -19,16 +18,11 @@ const _ = grpc.SupportPackageIsVersion7
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type HubClient interface {
SubscribeHeaders(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (Hub_SubscribeHeadersClient, error)
Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*Outputs, error)
GetBlock(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockOutput, error)
GetBlockHeader(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockHeaderOutput, error)
GetServerHeight(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.UInt64Value, error)
GetHeaders(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (Hub_GetHeadersClient, error)
Ping(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.StringValue, error)
Version(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.StringValue, error)
Features(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.StringValue, error)
Broadcast(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.UInt64Value, error)
Ping(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*StringValue, error)
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)
}
type hubClient struct {
@ -39,38 +33,6 @@ func NewHubClient(cc grpc.ClientConnInterface) HubClient {
return &hubClient{cc}
}
func (c *hubClient) SubscribeHeaders(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (Hub_SubscribeHeadersClient, error) {
stream, err := c.cc.NewStream(ctx, &Hub_ServiceDesc.Streams[0], "/pb.Hub/SubscribeHeaders", opts...)
if err != nil {
return nil, err
}
x := &hubSubscribeHeadersClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Hub_SubscribeHeadersClient interface {
Recv() (*BlockHeaderOutput, error)
grpc.ClientStream
}
type hubSubscribeHeadersClient struct {
grpc.ClientStream
}
func (x *hubSubscribeHeadersClient) Recv() (*BlockHeaderOutput, error) {
m := new(BlockHeaderOutput)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *hubClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*Outputs, error) {
out := new(Outputs)
err := c.cc.Invoke(ctx, "/pb.Hub/Search", in, out, opts...)
@ -80,67 +42,8 @@ func (c *hubClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.
return out, nil
}
func (c *hubClient) GetBlock(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockOutput, error) {
out := new(BlockOutput)
err := c.cc.Invoke(ctx, "/pb.Hub/GetBlock", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *hubClient) GetBlockHeader(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockHeaderOutput, error) {
out := new(BlockHeaderOutput)
err := c.cc.Invoke(ctx, "/pb.Hub/GetBlockHeader", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *hubClient) GetServerHeight(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.UInt64Value, error) {
out := new(wrapperspb.UInt64Value)
err := c.cc.Invoke(ctx, "/pb.Hub/GetServerHeight", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *hubClient) GetHeaders(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (Hub_GetHeadersClient, error) {
stream, err := c.cc.NewStream(ctx, &Hub_ServiceDesc.Streams[1], "/pb.Hub/GetHeaders", opts...)
if err != nil {
return nil, err
}
x := &hubGetHeadersClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Hub_GetHeadersClient interface {
Recv() (*BlockHeaderOutput, error)
grpc.ClientStream
}
type hubGetHeadersClient struct {
grpc.ClientStream
}
func (x *hubGetHeadersClient) Recv() (*BlockHeaderOutput, error) {
m := new(BlockHeaderOutput)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *hubClient) Ping(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) {
out := new(wrapperspb.StringValue)
func (c *hubClient) Ping(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*StringValue, error) {
out := new(StringValue)
err := c.cc.Invoke(ctx, "/pb.Hub/Ping", in, out, opts...)
if err != nil {
return nil, err
@ -148,8 +51,8 @@ func (c *hubClient) Ping(ctx context.Context, in *EmptyMessage, opts ...grpc.Cal
return out, nil
}
func (c *hubClient) Version(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) {
out := new(wrapperspb.StringValue)
func (c *hubClient) Version(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*StringValue, error) {
out := new(StringValue)
err := c.cc.Invoke(ctx, "/pb.Hub/Version", in, out, opts...)
if err != nil {
return nil, err
@ -157,8 +60,8 @@ func (c *hubClient) Version(ctx context.Context, in *EmptyMessage, opts ...grpc.
return out, nil
}
func (c *hubClient) Features(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.StringValue, error) {
out := new(wrapperspb.StringValue)
func (c *hubClient) Features(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*StringValue, error) {
out := new(StringValue)
err := c.cc.Invoke(ctx, "/pb.Hub/Features", in, out, opts...)
if err != nil {
return nil, err
@ -166,8 +69,8 @@ func (c *hubClient) Features(ctx context.Context, in *EmptyMessage, opts ...grpc
return out, nil
}
func (c *hubClient) Broadcast(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*wrapperspb.UInt64Value, error) {
out := new(wrapperspb.UInt64Value)
func (c *hubClient) Broadcast(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*UInt32Value, error) {
out := new(UInt32Value)
err := c.cc.Invoke(ctx, "/pb.Hub/Broadcast", in, out, opts...)
if err != nil {
return nil, err
@ -179,16 +82,11 @@ func (c *hubClient) Broadcast(ctx context.Context, in *EmptyMessage, opts ...grp
// All implementations must embed UnimplementedHubServer
// for forward compatibility
type HubServer interface {
SubscribeHeaders(*BlockRequest, Hub_SubscribeHeadersServer) error
Search(context.Context, *SearchRequest) (*Outputs, error)
GetBlock(context.Context, *BlockRequest) (*BlockOutput, error)
GetBlockHeader(context.Context, *BlockRequest) (*BlockHeaderOutput, error)
GetServerHeight(context.Context, *EmptyMessage) (*wrapperspb.UInt64Value, error)
GetHeaders(*BlockRequest, Hub_GetHeadersServer) error
Ping(context.Context, *EmptyMessage) (*wrapperspb.StringValue, error)
Version(context.Context, *EmptyMessage) (*wrapperspb.StringValue, error)
Features(context.Context, *EmptyMessage) (*wrapperspb.StringValue, error)
Broadcast(context.Context, *EmptyMessage) (*wrapperspb.UInt64Value, error)
Ping(context.Context, *EmptyMessage) (*StringValue, error)
Version(context.Context, *EmptyMessage) (*StringValue, error)
Features(context.Context, *EmptyMessage) (*StringValue, error)
Broadcast(context.Context, *EmptyMessage) (*UInt32Value, error)
mustEmbedUnimplementedHubServer()
}
@ -196,34 +94,19 @@ type HubServer interface {
type UnimplementedHubServer struct {
}
func (UnimplementedHubServer) SubscribeHeaders(*BlockRequest, Hub_SubscribeHeadersServer) error {
return status.Errorf(codes.Unimplemented, "method SubscribeHeaders not implemented")
}
func (UnimplementedHubServer) Search(context.Context, *SearchRequest) (*Outputs, error) {
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedHubServer) GetBlock(context.Context, *BlockRequest) (*BlockOutput, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBlock not implemented")
}
func (UnimplementedHubServer) GetBlockHeader(context.Context, *BlockRequest) (*BlockHeaderOutput, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeader not implemented")
}
func (UnimplementedHubServer) GetServerHeight(context.Context, *EmptyMessage) (*wrapperspb.UInt64Value, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetServerHeight not implemented")
}
func (UnimplementedHubServer) GetHeaders(*BlockRequest, Hub_GetHeadersServer) error {
return status.Errorf(codes.Unimplemented, "method GetHeaders not implemented")
}
func (UnimplementedHubServer) Ping(context.Context, *EmptyMessage) (*wrapperspb.StringValue, error) {
func (UnimplementedHubServer) Ping(context.Context, *EmptyMessage) (*StringValue, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedHubServer) Version(context.Context, *EmptyMessage) (*wrapperspb.StringValue, error) {
func (UnimplementedHubServer) Version(context.Context, *EmptyMessage) (*StringValue, error) {
return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
}
func (UnimplementedHubServer) Features(context.Context, *EmptyMessage) (*wrapperspb.StringValue, error) {
func (UnimplementedHubServer) Features(context.Context, *EmptyMessage) (*StringValue, error) {
return nil, status.Errorf(codes.Unimplemented, "method Features not implemented")
}
func (UnimplementedHubServer) Broadcast(context.Context, *EmptyMessage) (*wrapperspb.UInt64Value, error) {
func (UnimplementedHubServer) Broadcast(context.Context, *EmptyMessage) (*UInt32Value, error) {
return nil, status.Errorf(codes.Unimplemented, "method Broadcast not implemented")
}
func (UnimplementedHubServer) mustEmbedUnimplementedHubServer() {}
@ -239,27 +122,6 @@ func RegisterHubServer(s grpc.ServiceRegistrar, srv HubServer) {
s.RegisterService(&Hub_ServiceDesc, srv)
}
func _Hub_SubscribeHeaders_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(BlockRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(HubServer).SubscribeHeaders(m, &hubSubscribeHeadersServer{stream})
}
type Hub_SubscribeHeadersServer interface {
Send(*BlockHeaderOutput) error
grpc.ServerStream
}
type hubSubscribeHeadersServer struct {
grpc.ServerStream
}
func (x *hubSubscribeHeadersServer) Send(m *BlockHeaderOutput) error {
return x.ServerStream.SendMsg(m)
}
func _Hub_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchRequest)
if err := dec(in); err != nil {
@ -278,81 +140,6 @@ func _Hub_Search_Handler(srv interface{}, ctx context.Context, dec func(interfac
return interceptor(ctx, in, info, handler)
}
func _Hub_GetBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BlockRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HubServer).GetBlock(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.Hub/GetBlock",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HubServer).GetBlock(ctx, req.(*BlockRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Hub_GetBlockHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BlockRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HubServer).GetBlockHeader(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.Hub/GetBlockHeader",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HubServer).GetBlockHeader(ctx, req.(*BlockRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Hub_GetServerHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyMessage)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HubServer).GetServerHeight(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.Hub/GetServerHeight",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HubServer).GetServerHeight(ctx, req.(*EmptyMessage))
}
return interceptor(ctx, in, info, handler)
}
func _Hub_GetHeaders_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(BlockRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(HubServer).GetHeaders(m, &hubGetHeadersServer{stream})
}
type Hub_GetHeadersServer interface {
Send(*BlockHeaderOutput) error
grpc.ServerStream
}
type hubGetHeadersServer struct {
grpc.ServerStream
}
func (x *hubGetHeadersServer) Send(m *BlockHeaderOutput) error {
return x.ServerStream.SendMsg(m)
}
func _Hub_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyMessage)
if err := dec(in); err != nil {
@ -436,18 +223,6 @@ var Hub_ServiceDesc = grpc.ServiceDesc{
MethodName: "Search",
Handler: _Hub_Search_Handler,
},
{
MethodName: "GetBlock",
Handler: _Hub_GetBlock_Handler,
},
{
MethodName: "GetBlockHeader",
Handler: _Hub_GetBlockHeader_Handler,
},
{
MethodName: "GetServerHeight",
Handler: _Hub_GetServerHeight_Handler,
},
{
MethodName: "Ping",
Handler: _Hub_Ping_Handler,
@ -465,17 +240,6 @@ var Hub_ServiceDesc = grpc.ServiceDesc{
Handler: _Hub_Broadcast_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "SubscribeHeaders",
Handler: _Hub_SubscribeHeaders_Handler,
ServerStreams: true,
},
{
StreamName: "GetHeaders",
Handler: _Hub_GetHeaders_Handler,
ServerStreams: true,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "hub.proto",
}

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.17.3
// protoc v3.17.1
// source: result.proto
package pb
@ -556,238 +556,6 @@ func (x *Blocked) GetChannel() *Output {
return nil
}
type BlockOutput struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"`
Confirmations int32 `protobuf:"varint,2,opt,name=confirmations,proto3" json:"confirmations"`
}
func (x *BlockOutput) Reset() {
*x = BlockOutput{}
if protoimpl.UnsafeEnabled {
mi := &file_result_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BlockOutput) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BlockOutput) ProtoMessage() {}
func (x *BlockOutput) ProtoReflect() protoreflect.Message {
mi := &file_result_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BlockOutput.ProtoReflect.Descriptor instead.
func (*BlockOutput) Descriptor() ([]byte, []int) {
return file_result_proto_rawDescGZIP(), []int{5}
}
func (x *BlockOutput) GetHash() string {
if x != nil {
return x.Hash
}
return ""
}
func (x *BlockOutput) GetConfirmations() int32 {
if x != nil {
return x.Confirmations
}
return 0
}
//
//{ (json object)
//"hash" : "hex", (string) the block hash (same as provided)
//"confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain
//"height" : n, (numeric) The block height or index
//"version" : n, (numeric) The block version
//"versionHex" : "hex", (string) The block version formatted in hexadecimal
//"merkleroot" : "hex", (string) The merkle root
//"time" : xxx, (numeric) The block time expressed in UNIX epoch time
//"mediantime" : xxx, (numeric) The median block time expressed in UNIX epoch time
//"nonce" : n, (numeric) The nonce
//"bits" : "hex", (string) The bits
//"difficulty" : n, (numeric) The difficulty
//"chainwork" : "hex", (string) Expected number of hashes required to produce the current chain
//"nTx" : n, (numeric) The number of transactions in the block
//"previousblockhash" : "hex", (string) The hash of the previous block
//"nextblockhash" : "hex" (string) The hash of the next block
//}
type BlockHeaderOutput struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"`
Confirmations int64 `protobuf:"varint,2,opt,name=confirmations,proto3" json:"confirmations"`
Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height"`
Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version"`
VersionHex string `protobuf:"bytes,5,opt,name=versionHex,proto3" json:"versionHex"`
Merkleroot string `protobuf:"bytes,6,opt,name=merkleroot,proto3" json:"merkleroot"`
Time int64 `protobuf:"varint,7,opt,name=time,proto3" json:"time"`
Mediantime int64 `protobuf:"varint,8,opt,name=mediantime,proto3" json:"mediantime"`
Nonce int64 `protobuf:"varint,9,opt,name=nonce,proto3" json:"nonce"`
Bits string `protobuf:"bytes,10,opt,name=bits,proto3" json:"bits"`
Difficulty float64 `protobuf:"fixed64,11,opt,name=difficulty,proto3" json:"difficulty"`
Chainwork string `protobuf:"bytes,12,opt,name=chainwork,proto3" json:"chainwork"`
NTx int64 `protobuf:"varint,13,opt,name=nTx,proto3" json:"nTx"`
Previousblockhash string `protobuf:"bytes,14,opt,name=previousblockhash,proto3" json:"previousblockhash"`
Nextblockhash string `protobuf:"bytes,15,opt,name=nextblockhash,proto3" json:"nextblockhash"`
}
func (x *BlockHeaderOutput) Reset() {
*x = BlockHeaderOutput{}
if protoimpl.UnsafeEnabled {
mi := &file_result_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BlockHeaderOutput) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BlockHeaderOutput) ProtoMessage() {}
func (x *BlockHeaderOutput) ProtoReflect() protoreflect.Message {
mi := &file_result_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BlockHeaderOutput.ProtoReflect.Descriptor instead.
func (*BlockHeaderOutput) Descriptor() ([]byte, []int) {
return file_result_proto_rawDescGZIP(), []int{6}
}
func (x *BlockHeaderOutput) GetHash() string {
if x != nil {
return x.Hash
}
return ""
}
func (x *BlockHeaderOutput) GetConfirmations() int64 {
if x != nil {
return x.Confirmations
}
return 0
}
func (x *BlockHeaderOutput) GetHeight() int64 {
if x != nil {
return x.Height
}
return 0
}
func (x *BlockHeaderOutput) GetVersion() int64 {
if x != nil {
return x.Version
}
return 0
}
func (x *BlockHeaderOutput) GetVersionHex() string {
if x != nil {
return x.VersionHex
}
return ""
}
func (x *BlockHeaderOutput) GetMerkleroot() string {
if x != nil {
return x.Merkleroot
}
return ""
}
func (x *BlockHeaderOutput) GetTime() int64 {
if x != nil {
return x.Time
}
return 0
}
func (x *BlockHeaderOutput) GetMediantime() int64 {
if x != nil {
return x.Mediantime
}
return 0
}
func (x *BlockHeaderOutput) GetNonce() int64 {
if x != nil {
return x.Nonce
}
return 0
}
func (x *BlockHeaderOutput) GetBits() string {
if x != nil {
return x.Bits
}
return ""
}
func (x *BlockHeaderOutput) GetDifficulty() float64 {
if x != nil {
return x.Difficulty
}
return 0
}
func (x *BlockHeaderOutput) GetChainwork() string {
if x != nil {
return x.Chainwork
}
return ""
}
func (x *BlockHeaderOutput) GetNTx() int64 {
if x != nil {
return x.NTx
}
return 0
}
func (x *BlockHeaderOutput) GetPreviousblockhash() string {
if x != nil {
return x.Previousblockhash
}
return ""
}
func (x *BlockHeaderOutput) GetNextblockhash() string {
if x != nil {
return x.Nextblockhash
}
return ""
}
var File_result_proto protoreflect.FileDescriptor
var file_result_proto_rawDesc = []byte{
@ -872,43 +640,10 @@ var file_result_proto_rawDesc = []byte{
0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e,
0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x4f,
0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x47,
0x0a, 0x0b, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x12, 0x0a,
0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73,
0x68, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72,
0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xc1, 0x03, 0x0a, 0x11, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x12, 0x0a,
0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73,
0x68, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72,
0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68,
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12,
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x65, 0x72,
0x6b, 0x6c, 0x65, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d,
0x65, 0x72, 0x6b, 0x6c, 0x65, 0x72, 0x6f, 0x6f, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d,
0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a,
0x0a, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0a, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f,
0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x69, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x62, 0x69, 0x74, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69,
0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x64, 0x69, 0x66,
0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e,
0x77, 0x6f, 0x72, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x69,
0x6e, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x54, 0x78, 0x18, 0x0d, 0x20, 0x01,
0x28, 0x03, 0x52, 0x03, 0x6e, 0x54, 0x78, 0x12, 0x2c, 0x0a, 0x11, 0x70, 0x72, 0x65, 0x76, 0x69,
0x6f, 0x75, 0x73, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x68, 0x61, 0x73, 0x68, 0x18, 0x0e, 0x20, 0x01,
0x28, 0x09, 0x52, 0x11, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x68, 0x61, 0x73, 0x68, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x62, 0x6c, 0x6f,
0x63, 0x6b, 0x68, 0x61, 0x73, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65,
0x78, 0x74, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x68, 0x61, 0x73, 0x68, 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,
0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 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 (
@ -924,16 +659,14 @@ func file_result_proto_rawDescGZIP() []byte {
}
var file_result_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_result_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_result_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_result_proto_goTypes = []interface{}{
(Error_Code)(0), // 0: pb.Error.Code
(*Outputs)(nil), // 1: pb.Outputs
(*Output)(nil), // 2: pb.Output
(*ClaimMeta)(nil), // 3: pb.ClaimMeta
(*Error)(nil), // 4: pb.Error
(*Blocked)(nil), // 5: pb.Blocked
(*BlockOutput)(nil), // 6: pb.BlockOutput
(*BlockHeaderOutput)(nil), // 7: pb.BlockHeaderOutput
(Error_Code)(0), // 0: pb.Error.Code
(*Outputs)(nil), // 1: pb.Outputs
(*Output)(nil), // 2: pb.Output
(*ClaimMeta)(nil), // 3: pb.ClaimMeta
(*Error)(nil), // 4: pb.Error
(*Blocked)(nil), // 5: pb.Blocked
}
var file_result_proto_depIdxs = []int32{
2, // 0: pb.Outputs.txos:type_name -> pb.Output
@ -1019,30 +752,6 @@ func file_result_proto_init() {
return nil
}
}
file_result_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BlockOutput); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_result_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BlockHeaderOutput); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_result_proto_msgTypes[1].OneofWrappers = []interface{}{
(*Output_Claim)(nil),
@ -1054,7 +763,7 @@ func file_result_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_result_proto_rawDesc,
NumEnums: 1,
NumMessages: 7,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},

View file

@ -154,25 +154,6 @@ func (s *Server) recordErrorAndDie(err error) {
func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs, error) {
// TODO record metric search_counter
t0 := time.Now()
esUrl := s.Args.EsHost + ":" + s.Args.EsPort
tmpClient, err := elastic.NewClient(elastic.SetURL(esUrl), elastic.SetSniff(false))
if err != nil {
s.recordErrorAndReturn(err, "client_creation_error_counter")
return nil, err
}
var client = tmpClient
//if s.EsClient == nil {
// esUrl := s.Args.EsHost + ":" + s.Args.EsPort
// tmpClient, err := elastic.NewClient(elastic.SetURL(esUrl), elastic.SetSniff(false))
// if err != nil {
// s.recordErrorAndReturn(err, "client_creation_errors")
// return nil, err
// }
// client = tmpClient
// s.EsClient = client
//} else {
// client = s.EsClient
//}
var from = 0
var pageSize = 10
@ -222,7 +203,7 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
log.Printf("delta: %d\n", delta)
// TODO record metric query_time
if in.NoTotals != nil && !in.NoTotals.Value {
if in.NoTotals {
return &pb.Outputs{
Txos: txos,
ExtraTxos: extraTxos,

View file

@ -1,6 +1,8 @@
package server
import (
"context"
"fmt"
"log"
"os"
"regexp"
@ -9,10 +11,7 @@ import (
"github.com/olivere/elastic/v7"
"github.com/prometheus/client_golang/prometheus/promhttp"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/wrapperspb"
"log"
"net/http"
"regexp"
"time"
)
@ -157,10 +156,10 @@ func (s *Server) Hello(context context.Context, args *FederatedServer) (*Federat
return s.Servers[0], nil
}
func (s *Server) Ping(context context.Context, args *pb.EmptyMessage) (*wrapperspb.StringValue, error) {
return &wrapperspb.StringValue{Value: "Hello, world!"}, nil
func (s *Server) Ping(context context.Context, args *pb.EmptyMessage) (*pb.StringValue, error) {
return &pb.StringValue{Value: "Hello, world!"}, nil
}
func (s *Server) Version(context context.Context, args *pb.EmptyMessage) (*wrapperspb.StringValue, error) {
return &wrapperspb.StringValue{Value: getVersion("beta")}, nil
}
func (s *Server) Version(context context.Context, args *pb.EmptyMessage) (*pb.StringValue, error) {
return &pb.StringValue{Value: getVersion("beta")}, nil
}