Documentation ¶
Overview ¶
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
- func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
- func RegisterQueryServer(s grpc1.Server, srv QueryServer)
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (m *GenesisState) GetRules() []string
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (gs GenesisState) Validate() error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type Port
- type QueryClient
- type QueryRoutingRulesRequest
- func (*QueryRoutingRulesRequest) Descriptor() ([]byte, []int)
- func (m *QueryRoutingRulesRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryRoutingRulesRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryRoutingRulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryRoutingRulesRequest) ProtoMessage()
- func (m *QueryRoutingRulesRequest) Reset()
- func (m *QueryRoutingRulesRequest) Size() (n int)
- func (m *QueryRoutingRulesRequest) String() string
- func (m *QueryRoutingRulesRequest) Unmarshal(dAtA []byte) error
- func (m *QueryRoutingRulesRequest) XXX_DiscardUnknown()
- func (m *QueryRoutingRulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryRoutingRulesRequest) XXX_Merge(src proto.Message)
- func (m *QueryRoutingRulesRequest) XXX_Size() int
- func (m *QueryRoutingRulesRequest) XXX_Unmarshal(b []byte) error
- type QueryRoutingRulesResponse
- func (*QueryRoutingRulesResponse) Descriptor() ([]byte, []int)
- func (m *QueryRoutingRulesResponse) GetRules() []string
- func (m *QueryRoutingRulesResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryRoutingRulesResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryRoutingRulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryRoutingRulesResponse) ProtoMessage()
- func (m *QueryRoutingRulesResponse) Reset()
- func (m *QueryRoutingRulesResponse) Size() (n int)
- func (m *QueryRoutingRulesResponse) String() string
- func (m *QueryRoutingRulesResponse) Unmarshal(dAtA []byte) error
- func (m *QueryRoutingRulesResponse) XXX_DiscardUnknown()
- func (m *QueryRoutingRulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryRoutingRulesResponse) XXX_Merge(src proto.Message)
- func (m *QueryRoutingRulesResponse) XXX_Size() int
- func (m *QueryRoutingRulesResponse) XXX_Unmarshal(b []byte) error
- type QueryServer
- type Router
- type SetRoutingRulesProposal
- func (*SetRoutingRulesProposal) Descriptor() ([]byte, []int)
- func (cup *SetRoutingRulesProposal) GetDescription() string
- func (cup *SetRoutingRulesProposal) GetTitle() string
- func (m *SetRoutingRulesProposal) Marshal() (dAtA []byte, err error)
- func (m *SetRoutingRulesProposal) MarshalTo(dAtA []byte) (int, error)
- func (m *SetRoutingRulesProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (cup *SetRoutingRulesProposal) ProposalRoute() string
- func (cup *SetRoutingRulesProposal) ProposalType() string
- func (*SetRoutingRulesProposal) ProtoMessage()
- func (m *SetRoutingRulesProposal) Reset()
- func (m *SetRoutingRulesProposal) Size() (n int)
- func (m *SetRoutingRulesProposal) String() string
- func (m *SetRoutingRulesProposal) Unmarshal(dAtA []byte) error
- func (cup *SetRoutingRulesProposal) ValidateBasic() error
- func (m *SetRoutingRulesProposal) XXX_DiscardUnknown()
- func (m *SetRoutingRulesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SetRoutingRulesProposal) XXX_Merge(src proto.Message)
- func (m *SetRoutingRulesProposal) XXX_Size() int
- func (m *SetRoutingRulesProposal) XXX_Unmarshal(b []byte) error
- type TIBCModule
- type UnimplementedQueryServer
Constants ¶
const ( // SubModuleName defines the TIBC port name SubModuleName = "routing" // StoreKey is the store key string for TIBC ports StoreKey = SubModuleName // RouterKey is the message route for TIBC ports RouterKey = SubModuleName // QuerierRoute is the querier route for TIBC ports QuerierRoute = SubModuleName )
const (
ProposalTypeSetRoutingRules = "SetRoutingRules"
)
const (
// RulePattern format "source,dest,port"
RulePattern = "^(([a-zA-Z0-9\\.\\_\\+\\-\\#\\[\\]\\<\\>]{1,64}|[*]),){2}([a-zA-Z0-9\\.\\_\\+\\-\\#\\[\\]\\<\\>]{1,64}|[*])$"
)
Variables ¶
var ( ErrInvalidRoute = sdkerrors.Register(moduleName, 2, "route not found") ErrInvalidRule = sdkerrors.Register(moduleName, 3, "invalid rule") ErrFailMarshalRules = sdkerrors.Register(moduleName, 4, "failed to marshal rules") ErrFailUnmarshalRules = sdkerrors.Register(moduleName, 5, "failed to unmarshal rules") ErrRoutingRulesNotFound = sdkerrors.Register(moduleName, 6, "routing rules not found") )
TIBC routing sentinel errors
var ( ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") )
Functions ¶
func RegisterInterfaces ¶ added in v0.2.0
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers the routing interfaces to protobuf Any.
func RegisterQueryHandler ¶ added in v0.2.0
RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandlerClient ¶ added in v0.2.0
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerFromEndpoint ¶ added in v0.2.0
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerServer ¶ added in v0.2.0
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryServer ¶ added in v0.2.0
func RegisterQueryServer(s grpc1.Server, srv QueryServer)
Types ¶
type GenesisState ¶ added in v0.2.0
type GenesisState struct {
Rules []string `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
}
GenesisState defines the tibc channel submodule's genesis state.
func DefaultGenesisState ¶ added in v0.2.0
func DefaultGenesisState() GenesisState
func NewGenesisState ¶ added in v0.2.0
func NewGenesisState(rules []string) GenesisState
func (*GenesisState) Descriptor ¶ added in v0.2.0
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) GetRules ¶ added in v0.2.0
func (m *GenesisState) GetRules() []string
func (*GenesisState) Marshal ¶ added in v0.2.0
func (m *GenesisState) Marshal() (dAtA []byte, err error)
func (*GenesisState) MarshalTo ¶ added in v0.2.0
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
func (*GenesisState) MarshalToSizedBuffer ¶ added in v0.2.0
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisState) ProtoMessage ¶ added in v0.2.0
func (*GenesisState) ProtoMessage()
func (*GenesisState) Reset ¶ added in v0.2.0
func (m *GenesisState) Reset()
func (*GenesisState) Size ¶ added in v0.2.0
func (m *GenesisState) Size() (n int)
func (*GenesisState) String ¶ added in v0.2.0
func (m *GenesisState) String() string
func (*GenesisState) Unmarshal ¶ added in v0.2.0
func (m *GenesisState) Unmarshal(dAtA []byte) error
func (GenesisState) Validate ¶ added in v0.2.0
func (gs GenesisState) Validate() error
func (*GenesisState) XXX_DiscardUnknown ¶ added in v0.2.0
func (m *GenesisState) XXX_DiscardUnknown()
func (*GenesisState) XXX_Marshal ¶ added in v0.2.0
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisState) XXX_Merge ¶ added in v0.2.0
func (m *GenesisState) XXX_Merge(src proto.Message)
func (*GenesisState) XXX_Size ¶ added in v0.2.0
func (m *GenesisState) XXX_Size() int
func (*GenesisState) XXX_Unmarshal ¶ added in v0.2.0
func (m *GenesisState) XXX_Unmarshal(b []byte) error
type QueryClient ¶ added in v0.2.0
type QueryClient interface { // RoutingRules queries all routing rules. RoutingRules(ctx context.Context, in *QueryRoutingRulesRequest, opts ...grpc.CallOption) (*QueryRoutingRulesResponse, error) }
QueryClient is the client API for Query service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewQueryClient ¶ added in v0.2.0
func NewQueryClient(cc grpc1.ClientConn) QueryClient
type QueryRoutingRulesRequest ¶ added in v0.2.0
type QueryRoutingRulesRequest struct { }
QueryRoutingRulesRequest is the request type for the RoutingRules RPC method
func (*QueryRoutingRulesRequest) Descriptor ¶ added in v0.2.0
func (*QueryRoutingRulesRequest) Descriptor() ([]byte, []int)
func (*QueryRoutingRulesRequest) Marshal ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) Marshal() (dAtA []byte, err error)
func (*QueryRoutingRulesRequest) MarshalTo ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryRoutingRulesRequest) MarshalToSizedBuffer ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryRoutingRulesRequest) ProtoMessage ¶ added in v0.2.0
func (*QueryRoutingRulesRequest) ProtoMessage()
func (*QueryRoutingRulesRequest) Reset ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) Reset()
func (*QueryRoutingRulesRequest) Size ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) Size() (n int)
func (*QueryRoutingRulesRequest) String ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) String() string
func (*QueryRoutingRulesRequest) Unmarshal ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) Unmarshal(dAtA []byte) error
func (*QueryRoutingRulesRequest) XXX_DiscardUnknown ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) XXX_DiscardUnknown()
func (*QueryRoutingRulesRequest) XXX_Marshal ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryRoutingRulesRequest) XXX_Merge ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) XXX_Merge(src proto.Message)
func (*QueryRoutingRulesRequest) XXX_Size ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) XXX_Size() int
func (*QueryRoutingRulesRequest) XXX_Unmarshal ¶ added in v0.2.0
func (m *QueryRoutingRulesRequest) XXX_Unmarshal(b []byte) error
type QueryRoutingRulesResponse ¶ added in v0.2.0
type QueryRoutingRulesResponse struct { // rule string array Rules []string `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"` }
QueryRoutingRulesResponse defines the routing rules query response
func (*QueryRoutingRulesResponse) Descriptor ¶ added in v0.2.0
func (*QueryRoutingRulesResponse) Descriptor() ([]byte, []int)
func (*QueryRoutingRulesResponse) GetRules ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) GetRules() []string
func (*QueryRoutingRulesResponse) Marshal ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) Marshal() (dAtA []byte, err error)
func (*QueryRoutingRulesResponse) MarshalTo ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryRoutingRulesResponse) MarshalToSizedBuffer ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryRoutingRulesResponse) ProtoMessage ¶ added in v0.2.0
func (*QueryRoutingRulesResponse) ProtoMessage()
func (*QueryRoutingRulesResponse) Reset ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) Reset()
func (*QueryRoutingRulesResponse) Size ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) Size() (n int)
func (*QueryRoutingRulesResponse) String ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) String() string
func (*QueryRoutingRulesResponse) Unmarshal ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) Unmarshal(dAtA []byte) error
func (*QueryRoutingRulesResponse) XXX_DiscardUnknown ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) XXX_DiscardUnknown()
func (*QueryRoutingRulesResponse) XXX_Marshal ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryRoutingRulesResponse) XXX_Merge ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) XXX_Merge(src proto.Message)
func (*QueryRoutingRulesResponse) XXX_Size ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) XXX_Size() int
func (*QueryRoutingRulesResponse) XXX_Unmarshal ¶ added in v0.2.0
func (m *QueryRoutingRulesResponse) XXX_Unmarshal(b []byte) error
type QueryServer ¶ added in v0.2.0
type QueryServer interface { // RoutingRules queries all routing rules. RoutingRules(context.Context, *QueryRoutingRulesRequest) (*QueryRoutingRulesResponse, error) }
QueryServer is the server API for Query service.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
The router is a map from module name to the TIBCModule which contains all the module-defined callbacks required by TICS-26
func (*Router) AddRoute ¶
func (rtr *Router) AddRoute(port Port, cbs TIBCModule) *Router
AddRoute adds TIBCModule for a given module name. It returns the Router so AddRoute calls can be linked. It will panic if the Router is sealed.
func (*Router) GetRoute ¶
func (rtr *Router) GetRoute(port Port) (TIBCModule, bool)
GetRoute returns a TIBCModule for a given module.
func (*Router) HasRoute ¶
HasRoute returns true if the Router has a module registered or false otherwise.
type SetRoutingRulesProposal ¶ added in v0.2.0
type SetRoutingRulesProposal struct { // the title of the update proposal Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` // the description of the proposal Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // routing rules list Rules []string `protobuf:"bytes,3,rep,name=rules,proto3" json:"rules,omitempty"` }
SetRoutingRulesProposal defines a proposal to set routing rules
func NewSetRoutingRulesProposal ¶ added in v0.2.0
func NewSetRoutingRulesProposal(title, description string, rules []string) (*SetRoutingRulesProposal, error)
NewSetRoutingRulesProposal creates a new setting rules proposal.
func (*SetRoutingRulesProposal) Descriptor ¶ added in v0.2.0
func (*SetRoutingRulesProposal) Descriptor() ([]byte, []int)
func (*SetRoutingRulesProposal) GetDescription ¶ added in v0.2.0
func (cup *SetRoutingRulesProposal) GetDescription() string
GetDescription returns the description of a setting rules proposal.
func (*SetRoutingRulesProposal) GetTitle ¶ added in v0.2.0
func (cup *SetRoutingRulesProposal) GetTitle() string
GetTitle returns the title of a setting rules proposal.
func (*SetRoutingRulesProposal) Marshal ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) Marshal() (dAtA []byte, err error)
func (*SetRoutingRulesProposal) MarshalTo ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) MarshalTo(dAtA []byte) (int, error)
func (*SetRoutingRulesProposal) MarshalToSizedBuffer ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SetRoutingRulesProposal) ProposalRoute ¶ added in v0.2.0
func (cup *SetRoutingRulesProposal) ProposalRoute() string
ProposalRoute returns the routing key of a setting rules proposal.
func (*SetRoutingRulesProposal) ProposalType ¶ added in v0.2.0
func (cup *SetRoutingRulesProposal) ProposalType() string
ProposalType returns the type of a setting rules proposal.
func (*SetRoutingRulesProposal) ProtoMessage ¶ added in v0.2.0
func (*SetRoutingRulesProposal) ProtoMessage()
func (*SetRoutingRulesProposal) Reset ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) Reset()
func (*SetRoutingRulesProposal) Size ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) Size() (n int)
func (*SetRoutingRulesProposal) String ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) String() string
func (*SetRoutingRulesProposal) Unmarshal ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) Unmarshal(dAtA []byte) error
func (*SetRoutingRulesProposal) ValidateBasic ¶ added in v0.2.0
func (cup *SetRoutingRulesProposal) ValidateBasic() error
ValidateBasic runs basic stateless validity checks
func (*SetRoutingRulesProposal) XXX_DiscardUnknown ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) XXX_DiscardUnknown()
func (*SetRoutingRulesProposal) XXX_Marshal ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SetRoutingRulesProposal) XXX_Merge ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) XXX_Merge(src proto.Message)
func (*SetRoutingRulesProposal) XXX_Size ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) XXX_Size() int
func (*SetRoutingRulesProposal) XXX_Unmarshal ¶ added in v0.2.0
func (m *SetRoutingRulesProposal) XXX_Unmarshal(b []byte) error
type TIBCModule ¶
type TIBCModule interface { // OnRecvPacket must return the acknowledgement bytes // In the case of an asynchronous acknowledgement, nil should be returned. OnRecvPacket( ctx sdk.Context, packet packettypes.Packet, ) (*sdk.Result, []byte, error) OnAcknowledgementPacket( ctx sdk.Context, packet packettypes.Packet, acknowledgement []byte, ) (*sdk.Result, error) }
TIBCModule defines an interface that implements all the callbacks that modules must define as specified in TICS-26
type UnimplementedQueryServer ¶ added in v0.2.0
type UnimplementedQueryServer struct { }
UnimplementedQueryServer can be embedded to have forward compatible implementations.
func (*UnimplementedQueryServer) RoutingRules ¶ added in v0.2.0
func (*UnimplementedQueryServer) RoutingRules(ctx context.Context, req *QueryRoutingRulesRequest) (*QueryRoutingRulesResponse, error)