node

package
v3.0.0-rc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package node is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterGRPCGatewayRoutes

func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux)

RegisterGRPCGatewayRoutes mounts the node gRPC service's GRPC-gateway routes on the given mux object.

func RegisterNodeService

func RegisterNodeService(clientCtx client.Context, server gogogrpc.Server, cfg config.Config)

RegisterNodeService registers the node gRPC service on the provided gRPC router.

func RegisterServiceHandler

func RegisterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterServiceHandler registers the http handlers for service Service to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterServiceHandlerClient

func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error

RegisterServiceHandlerClient registers the http handlers for service Service to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ServiceClient" to call the correct interceptors.

func RegisterServiceHandlerFromEndpoint

func RegisterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterServiceHandlerFromEndpoint is same as RegisterServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterServiceHandlerServer

func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error

RegisterServiceHandlerServer registers the http handlers for service Service to "mux". UnaryRPC :call ServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceHandlerFromEndpoint instead.

func RegisterServiceServer

func RegisterServiceServer(s grpc1.Server, srv ServiceServer)

Types

type ChainIDRequest

type ChainIDRequest struct {
}

ChainIDRequest is request type for the Service/ChainID RPC method.

func (*ChainIDRequest) Descriptor

func (*ChainIDRequest) Descriptor() ([]byte, []int)

func (*ChainIDRequest) Marshal

func (m *ChainIDRequest) Marshal() (dAtA []byte, err error)

func (*ChainIDRequest) MarshalTo

func (m *ChainIDRequest) MarshalTo(dAtA []byte) (int, error)

func (*ChainIDRequest) MarshalToSizedBuffer

func (m *ChainIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ChainIDRequest) ProtoMessage

func (*ChainIDRequest) ProtoMessage()

func (*ChainIDRequest) Reset

func (m *ChainIDRequest) Reset()

func (*ChainIDRequest) Size

func (m *ChainIDRequest) Size() (n int)

func (*ChainIDRequest) String

func (m *ChainIDRequest) String() string

func (*ChainIDRequest) Unmarshal

func (m *ChainIDRequest) Unmarshal(dAtA []byte) error

func (*ChainIDRequest) XXX_DiscardUnknown

func (m *ChainIDRequest) XXX_DiscardUnknown()

func (*ChainIDRequest) XXX_Marshal

func (m *ChainIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChainIDRequest) XXX_Merge

func (m *ChainIDRequest) XXX_Merge(src proto.Message)

func (*ChainIDRequest) XXX_Size

func (m *ChainIDRequest) XXX_Size() int

func (*ChainIDRequest) XXX_Unmarshal

func (m *ChainIDRequest) XXX_Unmarshal(b []byte) error

type ChainIDResponse

type ChainIDResponse struct {
	ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}

ChainIDResponse is response type for the Service/ChainID RPC method.

func (*ChainIDResponse) Descriptor

func (*ChainIDResponse) Descriptor() ([]byte, []int)

func (*ChainIDResponse) GetChainID

func (m *ChainIDResponse) GetChainID() string

func (*ChainIDResponse) Marshal

func (m *ChainIDResponse) Marshal() (dAtA []byte, err error)

func (*ChainIDResponse) MarshalTo

func (m *ChainIDResponse) MarshalTo(dAtA []byte) (int, error)

func (*ChainIDResponse) MarshalToSizedBuffer

func (m *ChainIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ChainIDResponse) ProtoMessage

func (*ChainIDResponse) ProtoMessage()

func (*ChainIDResponse) Reset

func (m *ChainIDResponse) Reset()

func (*ChainIDResponse) Size

func (m *ChainIDResponse) Size() (n int)

func (*ChainIDResponse) String

func (m *ChainIDResponse) String() string

func (*ChainIDResponse) Unmarshal

func (m *ChainIDResponse) Unmarshal(dAtA []byte) error

func (*ChainIDResponse) XXX_DiscardUnknown

func (m *ChainIDResponse) XXX_DiscardUnknown()

func (*ChainIDResponse) XXX_Marshal

func (m *ChainIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChainIDResponse) XXX_Merge

func (m *ChainIDResponse) XXX_Merge(src proto.Message)

func (*ChainIDResponse) XXX_Size

func (m *ChainIDResponse) XXX_Size() int

func (*ChainIDResponse) XXX_Unmarshal

func (m *ChainIDResponse) XXX_Unmarshal(b []byte) error

type EVMValidatorsRequest

type EVMValidatorsRequest struct {
}

EVMValidatorsRequest is request type for the Service/EVMValidators RPC method.

func (*EVMValidatorsRequest) Descriptor

func (*EVMValidatorsRequest) Descriptor() ([]byte, []int)

func (*EVMValidatorsRequest) Marshal

func (m *EVMValidatorsRequest) Marshal() (dAtA []byte, err error)

func (*EVMValidatorsRequest) MarshalTo

func (m *EVMValidatorsRequest) MarshalTo(dAtA []byte) (int, error)

func (*EVMValidatorsRequest) MarshalToSizedBuffer

func (m *EVMValidatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EVMValidatorsRequest) ProtoMessage

func (*EVMValidatorsRequest) ProtoMessage()

func (*EVMValidatorsRequest) Reset

func (m *EVMValidatorsRequest) Reset()

func (*EVMValidatorsRequest) Size

func (m *EVMValidatorsRequest) Size() (n int)

func (*EVMValidatorsRequest) String

func (m *EVMValidatorsRequest) String() string

func (*EVMValidatorsRequest) Unmarshal

func (m *EVMValidatorsRequest) Unmarshal(dAtA []byte) error

func (*EVMValidatorsRequest) XXX_DiscardUnknown

func (m *EVMValidatorsRequest) XXX_DiscardUnknown()

func (*EVMValidatorsRequest) XXX_Marshal

func (m *EVMValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EVMValidatorsRequest) XXX_Merge

func (m *EVMValidatorsRequest) XXX_Merge(src proto.Message)

func (*EVMValidatorsRequest) XXX_Size

func (m *EVMValidatorsRequest) XXX_Size() int

func (*EVMValidatorsRequest) XXX_Unmarshal

func (m *EVMValidatorsRequest) XXX_Unmarshal(b []byte) error

type EVMValidatorsResponse

type EVMValidatorsResponse struct {
	// BlockHeight is the latest block height
	BlockHeight int64 `protobuf:"varint,1,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
	// Validators is list of validator's addresss and voting power
	Validators []ValidatorMinimal `protobuf:"bytes,2,rep,name=validators,proto3" json:"validators"`
}

EVMValidatorsResponse is response type for the Service/EVMValidators RPC method.

func (*EVMValidatorsResponse) Descriptor

func (*EVMValidatorsResponse) Descriptor() ([]byte, []int)

func (*EVMValidatorsResponse) GetBlockHeight

func (m *EVMValidatorsResponse) GetBlockHeight() int64

func (*EVMValidatorsResponse) GetValidators

func (m *EVMValidatorsResponse) GetValidators() []ValidatorMinimal

func (*EVMValidatorsResponse) Marshal

func (m *EVMValidatorsResponse) Marshal() (dAtA []byte, err error)

func (*EVMValidatorsResponse) MarshalTo

func (m *EVMValidatorsResponse) MarshalTo(dAtA []byte) (int, error)

func (*EVMValidatorsResponse) MarshalToSizedBuffer

func (m *EVMValidatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EVMValidatorsResponse) ProtoMessage

func (*EVMValidatorsResponse) ProtoMessage()

func (*EVMValidatorsResponse) Reset

func (m *EVMValidatorsResponse) Reset()

func (*EVMValidatorsResponse) Size

func (m *EVMValidatorsResponse) Size() (n int)

func (*EVMValidatorsResponse) String

func (m *EVMValidatorsResponse) String() string

func (*EVMValidatorsResponse) Unmarshal

func (m *EVMValidatorsResponse) Unmarshal(dAtA []byte) error

func (*EVMValidatorsResponse) XXX_DiscardUnknown

func (m *EVMValidatorsResponse) XXX_DiscardUnknown()

func (*EVMValidatorsResponse) XXX_Marshal

func (m *EVMValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EVMValidatorsResponse) XXX_Merge

func (m *EVMValidatorsResponse) XXX_Merge(src proto.Message)

func (*EVMValidatorsResponse) XXX_Size

func (m *EVMValidatorsResponse) XXX_Size() int

func (*EVMValidatorsResponse) XXX_Unmarshal

func (m *EVMValidatorsResponse) XXX_Unmarshal(b []byte) error

type ServiceClient

type ServiceClient interface {
	// ChainID queries the chain ID of this node
	ChainID(ctx context.Context, in *ChainIDRequest, opts ...grpc.CallOption) (*ChainIDResponse, error)
	// EVMValidators queries current list of validator's address and power
	EVMValidators(ctx context.Context, in *EVMValidatorsRequest, opts ...grpc.CallOption) (*EVMValidatorsResponse, error)
}

ServiceClient is the client API for Service service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewServiceClient

func NewServiceClient(cc grpc1.ClientConn) ServiceClient

type ServiceServer

type ServiceServer interface {
	// ChainID queries the chain ID of this node
	ChainID(context.Context, *ChainIDRequest) (*ChainIDResponse, error)
	// EVMValidators queries current list of validator's address and power
	EVMValidators(context.Context, *EVMValidatorsRequest) (*EVMValidatorsResponse, error)
}

ServiceServer is the server API for Service service.

func NewQueryServer

func NewQueryServer(clientCtx client.Context, cfg config.Config) ServiceServer

NewQueryServer returns new queryServer from provided client.Context

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedServiceServer) ChainID

func (*UnimplementedServiceServer) EVMValidators

type ValidatorMinimal

type ValidatorMinimal struct {
	Address     string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	VotingPower int64  `protobuf:"varint,2,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"`
}

ValidatorMinimal is the data structure for storing validator's address and voting power

func (*ValidatorMinimal) Descriptor

func (*ValidatorMinimal) Descriptor() ([]byte, []int)

func (*ValidatorMinimal) GetAddress

func (m *ValidatorMinimal) GetAddress() string

func (*ValidatorMinimal) GetVotingPower

func (m *ValidatorMinimal) GetVotingPower() int64

func (*ValidatorMinimal) Marshal

func (m *ValidatorMinimal) Marshal() (dAtA []byte, err error)

func (*ValidatorMinimal) MarshalTo

func (m *ValidatorMinimal) MarshalTo(dAtA []byte) (int, error)

func (*ValidatorMinimal) MarshalToSizedBuffer

func (m *ValidatorMinimal) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ValidatorMinimal) ProtoMessage

func (*ValidatorMinimal) ProtoMessage()

func (*ValidatorMinimal) Reset

func (m *ValidatorMinimal) Reset()

func (*ValidatorMinimal) Size

func (m *ValidatorMinimal) Size() (n int)

func (*ValidatorMinimal) String

func (m *ValidatorMinimal) String() string

func (*ValidatorMinimal) Unmarshal

func (m *ValidatorMinimal) Unmarshal(dAtA []byte) error

func (*ValidatorMinimal) XXX_DiscardUnknown

func (m *ValidatorMinimal) XXX_DiscardUnknown()

func (*ValidatorMinimal) XXX_Marshal

func (m *ValidatorMinimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ValidatorMinimal) XXX_Merge

func (m *ValidatorMinimal) XXX_Merge(src proto.Message)

func (*ValidatorMinimal) XXX_Size

func (m *ValidatorMinimal) XXX_Size() int

func (*ValidatorMinimal) XXX_Unmarshal

func (m *ValidatorMinimal) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL