tx

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package tx is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterGRPCGatewayRoutes

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

RegisterGRPCGatewayRoutes mounts the tx service's GRPC-gateway routes on the given Mux.

func RegisterTxHandler

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

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

func RegisterTxHandlerClient

func RegisterTxHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TxClient) error

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

func RegisterTxHandlerFromEndpoint

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

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

func RegisterTxHandlerServer

func RegisterTxHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TxServer) error

RegisterTxHandlerServer registers the http handlers for service Tx to "mux". UnaryRPC :call TxServer 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 RegisterTxHandlerFromEndpoint instead.

func RegisterTxServer

func RegisterTxServer(s grpc1.Server, srv TxServer)

func RegisterTxService

func RegisterTxService(
	qrt gogogrpc.Server,
	clientCtx client.Context,
	interfaceRegistry codectypes.InterfaceRegistry,
)

RegisterTxService registers the tx service on the gRPC router.

Types

type TxClient

type TxClient interface {
	// TxStatus returns the status of a transaction. There are four possible states:
	// - Committed
	// - Pending
	// - Evicted
	// - Unknown
	TxStatus(ctx context.Context, in *TxStatusRequest, opts ...grpc.CallOption) (*TxStatusResponse, error)
}

TxClient is the client API for Tx service.

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

func NewTxClient

func NewTxClient(cc grpc1.ClientConn) TxClient

type TxServer

type TxServer interface {
	// TxStatus returns the status of a transaction. There are four possible states:
	// - Committed
	// - Pending
	// - Evicted
	// - Unknown
	TxStatus(context.Context, *TxStatusRequest) (*TxStatusResponse, error)
}

TxServer is the server API for Tx service.

func NewTxServer

func NewTxServer(clientCtx client.Context, interfaceRegistry codectypes.InterfaceRegistry) TxServer

type TxStatusRequest

type TxStatusRequest struct {
	// this is the hex encoded transaction hash (should be 64 bytes long)
	TxId string `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"`
}

TxStatusRequest is the request type for the TxStatus gRPC method.

func (*TxStatusRequest) Descriptor

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

func (*TxStatusRequest) GetTxId

func (m *TxStatusRequest) GetTxId() string

func (*TxStatusRequest) Marshal

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

func (*TxStatusRequest) MarshalTo

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

func (*TxStatusRequest) MarshalToSizedBuffer

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

func (*TxStatusRequest) ProtoMessage

func (*TxStatusRequest) ProtoMessage()

func (*TxStatusRequest) Reset

func (m *TxStatusRequest) Reset()

func (*TxStatusRequest) Size

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

func (*TxStatusRequest) String

func (m *TxStatusRequest) String() string

func (*TxStatusRequest) Unmarshal

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

func (*TxStatusRequest) XXX_DiscardUnknown

func (m *TxStatusRequest) XXX_DiscardUnknown()

func (*TxStatusRequest) XXX_Marshal

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

func (*TxStatusRequest) XXX_Merge

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

func (*TxStatusRequest) XXX_Size

func (m *TxStatusRequest) XXX_Size() int

func (*TxStatusRequest) XXX_Unmarshal

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

type TxStatusResponse

type TxStatusResponse struct {
	Height int64  `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	Index  uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	// execution_code is returned when the transaction has been committed
	// and returns whether it was successful or errored. A non zero
	// execution code indicated an error.
	ExecutionCode uint32 `protobuf:"varint,3,opt,name=execution_code,json=executionCode,proto3" json:"execution_code,omitempty"`
	// error log for failed transactions.
	Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
	// status is the status of the transaction.
	Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"`
}

TxStatusResponse is the response type for the TxStatus gRPC method.

func (*TxStatusResponse) Descriptor

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

func (*TxStatusResponse) GetError

func (m *TxStatusResponse) GetError() string

func (*TxStatusResponse) GetExecutionCode

func (m *TxStatusResponse) GetExecutionCode() uint32

func (*TxStatusResponse) GetHeight

func (m *TxStatusResponse) GetHeight() int64

func (*TxStatusResponse) GetIndex

func (m *TxStatusResponse) GetIndex() uint32

func (*TxStatusResponse) GetStatus

func (m *TxStatusResponse) GetStatus() string

func (*TxStatusResponse) Marshal

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

func (*TxStatusResponse) MarshalTo

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

func (*TxStatusResponse) MarshalToSizedBuffer

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

func (*TxStatusResponse) ProtoMessage

func (*TxStatusResponse) ProtoMessage()

func (*TxStatusResponse) Reset

func (m *TxStatusResponse) Reset()

func (*TxStatusResponse) Size

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

func (*TxStatusResponse) String

func (m *TxStatusResponse) String() string

func (*TxStatusResponse) Unmarshal

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

func (*TxStatusResponse) XXX_DiscardUnknown

func (m *TxStatusResponse) XXX_DiscardUnknown()

func (*TxStatusResponse) XXX_Marshal

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

func (*TxStatusResponse) XXX_Merge

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

func (*TxStatusResponse) XXX_Size

func (m *TxStatusResponse) XXX_Size() int

func (*TxStatusResponse) XXX_Unmarshal

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

type UnimplementedTxServer

type UnimplementedTxServer struct {
}

UnimplementedTxServer can be embedded to have forward compatible implementations.

func (*UnimplementedTxServer) TxStatus

Jump to

Keyboard shortcuts

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