api

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 19 Imported by: 10

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRpcCrossChainHandler

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

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

func RegisterRpcCrossChainHandlerClient

func RegisterRpcCrossChainHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RpcCrossChainClient) error

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

func RegisterRpcCrossChainHandlerFromEndpoint

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

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

func RegisterRpcCrossChainHandlerServer

func RegisterRpcCrossChainHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RpcCrossChainServer) error

RegisterRpcCrossChainHandlerServer registers the http handlers for service RpcCrossChain to "mux". UnaryRPC :call RpcCrossChainServer 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 RegisterRpcCrossChainHandlerFromEndpoint instead.

func RegisterRpcCrossChainServer

func RegisterRpcCrossChainServer(s *grpc.Server, srv RpcCrossChainServer)

func RegisterRpcRelayChainHandler

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

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

func RegisterRpcRelayChainHandlerClient

func RegisterRpcRelayChainHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RpcRelayChainClient) error

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

func RegisterRpcRelayChainHandlerFromEndpoint

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

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

func RegisterRpcRelayChainHandlerServer

func RegisterRpcRelayChainHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RpcRelayChainServer) error

RegisterRpcRelayChainHandlerServer registers the http handlers for service RpcRelayChain to "mux". UnaryRPC :call RpcRelayChainServer 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 RegisterRpcRelayChainHandlerFromEndpoint instead.

func RegisterRpcRelayChainServer

func RegisterRpcRelayChainServer(s *grpc.Server, srv RpcRelayChainServer)

Types

type RpcCrossChainClient

type RpcCrossChainClient interface {
	// 接收跨链请求的接口
	CrossChainTry(ctx context.Context, in *cross_chain.CrossChainTryRequest, opts ...grpc.CallOption) (*cross_chain.CrossChainTryResponse, error)
	// 跨链结果确认,提交
	CrossChainConfirm(ctx context.Context, in *cross_chain.CrossChainConfirmRequest, opts ...grpc.CallOption) (*cross_chain.CrossChainConfirmResponse, error)
	// 跨链结果确认,回滚
	CrossChainCancel(ctx context.Context, in *cross_chain.CrossChainCancelRequest, opts ...grpc.CallOption) (*cross_chain.CrossChainCancelResponse, error)
	// 判断跨链结果
	IsCrossChainSuccess(ctx context.Context, in *cross_chain.IsCrossChainSuccessRequest, opts ...grpc.CallOption) (*cross_chain.IsCrossChainSuccessResponse, error)
	// rpc交易验证,不是非要在当前服务中实现
	TxVerify(ctx context.Context, in *cross_chain.TxVerifyRequest, opts ...grpc.CallOption) (*cross_chain.TxVerifyResponse, error)
	// 跨链触发器管理
	CrossChainEvent(ctx context.Context, in *cross_chain.CrossChainEventRequest, opts ...grpc.CallOption) (*cross_chain.CrossChainEventResponse, error)
	// 链身份管理
	ChainIdentity(ctx context.Context, in *cross_chain.ChainIdentityRequest, opts ...grpc.CallOption) (*cross_chain.ChainIdentityResponse, error)
	// 心跳检测
	PingPong(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*cross_chain.PingPongResponse, error)
}

RpcCrossChainClient is the client API for RpcCrossChain service.

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

func NewRpcCrossChainClient

func NewRpcCrossChainClient(cc *grpc.ClientConn) RpcCrossChainClient

type RpcCrossChainServer

type RpcCrossChainServer interface {
	// 接收跨链请求的接口
	CrossChainTry(context.Context, *cross_chain.CrossChainTryRequest) (*cross_chain.CrossChainTryResponse, error)
	// 跨链结果确认,提交
	CrossChainConfirm(context.Context, *cross_chain.CrossChainConfirmRequest) (*cross_chain.CrossChainConfirmResponse, error)
	// 跨链结果确认,回滚
	CrossChainCancel(context.Context, *cross_chain.CrossChainCancelRequest) (*cross_chain.CrossChainCancelResponse, error)
	// 判断跨链结果
	IsCrossChainSuccess(context.Context, *cross_chain.IsCrossChainSuccessRequest) (*cross_chain.IsCrossChainSuccessResponse, error)
	// rpc交易验证,不是非要在当前服务中实现
	TxVerify(context.Context, *cross_chain.TxVerifyRequest) (*cross_chain.TxVerifyResponse, error)
	// 跨链触发器管理
	CrossChainEvent(context.Context, *cross_chain.CrossChainEventRequest) (*cross_chain.CrossChainEventResponse, error)
	// 链身份管理
	ChainIdentity(context.Context, *cross_chain.ChainIdentityRequest) (*cross_chain.ChainIdentityResponse, error)
	// 心跳检测
	PingPong(context.Context, *emptypb.Empty) (*cross_chain.PingPongResponse, error)
}

RpcCrossChainServer is the server API for RpcCrossChain service.

type RpcRelayChainClient

type RpcRelayChainClient interface {
	// 同步区块头
	SyncBlockHeader(ctx context.Context, in *relay_chain.SyncBlockHeaderRequest, opts ...grpc.CallOption) (*relay_chain.SyncBlockHeaderResponse, error)
	// 接收跨链请求
	BeginCrossChain(ctx context.Context, in *relay_chain.BeginCrossChainRequest, opts ...grpc.CallOption) (*relay_chain.BeginCrossChainResponse, error)
	// 网关注册
	GatewayRegister(ctx context.Context, in *relay_chain.GatewayRegisterRequest, opts ...grpc.CallOption) (*relay_chain.GatewayRegisterResponse, error)
	// 网关信息更新
	GatewayUpdate(ctx context.Context, in *relay_chain.GatewayUpdateRequest, opts ...grpc.CallOption) (*relay_chain.GatewayUpdateResponse, error)
	// 用于具有同步区块头、交易验证功能的spv合约的创建
	InitContract(ctx context.Context, in *relay_chain.InitContractRequest, opts ...grpc.CallOption) (*relay_chain.InitContractResponse, error)
	// 用于具有同步区块头、交易验证功能的spv合约的更新
	UpdateContract(ctx context.Context, in *relay_chain.UpdateContractRequest, opts ...grpc.CallOption) (*relay_chain.UpdateContractResponse, error)
	// 网关信息查询
	QueryGateway(ctx context.Context, in *relay_chain.QueryGatewayRequest, opts ...grpc.CallOption) (*relay_chain.QueryGatewayResponse, error)
	// 跨链信息查询,暂不支持通过业务链交易id查询跨链交易,用户需要自行维护业务链的交易id与跨链交易id的映射关系
	QueryCrossChain(ctx context.Context, in *relay_chain.QueryCrossChainRequest, opts ...grpc.CallOption) (*relay_chain.QueryCrossChainResponse, error)
}

RpcRelayChainClient is the client API for RpcRelayChain service.

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

func NewRpcRelayChainClient

func NewRpcRelayChainClient(cc *grpc.ClientConn) RpcRelayChainClient

type RpcRelayChainServer

type RpcRelayChainServer interface {
	// 同步区块头
	SyncBlockHeader(context.Context, *relay_chain.SyncBlockHeaderRequest) (*relay_chain.SyncBlockHeaderResponse, error)
	// 接收跨链请求
	BeginCrossChain(context.Context, *relay_chain.BeginCrossChainRequest) (*relay_chain.BeginCrossChainResponse, error)
	// 网关注册
	GatewayRegister(context.Context, *relay_chain.GatewayRegisterRequest) (*relay_chain.GatewayRegisterResponse, error)
	// 网关信息更新
	GatewayUpdate(context.Context, *relay_chain.GatewayUpdateRequest) (*relay_chain.GatewayUpdateResponse, error)
	// 用于具有同步区块头、交易验证功能的spv合约的创建
	InitContract(context.Context, *relay_chain.InitContractRequest) (*relay_chain.InitContractResponse, error)
	// 用于具有同步区块头、交易验证功能的spv合约的更新
	UpdateContract(context.Context, *relay_chain.UpdateContractRequest) (*relay_chain.UpdateContractResponse, error)
	// 网关信息查询
	QueryGateway(context.Context, *relay_chain.QueryGatewayRequest) (*relay_chain.QueryGatewayResponse, error)
	// 跨链信息查询,暂不支持通过业务链交易id查询跨链交易,用户需要自行维护业务链的交易id与跨链交易id的映射关系
	QueryCrossChain(context.Context, *relay_chain.QueryCrossChainRequest) (*relay_chain.QueryCrossChainResponse, error)
}

RpcRelayChainServer is the server API for RpcRelayChain service.

type UnimplementedRpcCrossChainServer

type UnimplementedRpcCrossChainServer struct {
}

UnimplementedRpcCrossChainServer can be embedded to have forward compatible implementations.

func (*UnimplementedRpcCrossChainServer) ChainIdentity

func (*UnimplementedRpcCrossChainServer) CrossChainCancel

func (*UnimplementedRpcCrossChainServer) CrossChainConfirm

func (*UnimplementedRpcCrossChainServer) CrossChainEvent

func (*UnimplementedRpcCrossChainServer) CrossChainTry

func (*UnimplementedRpcCrossChainServer) IsCrossChainSuccess

func (*UnimplementedRpcCrossChainServer) PingPong

func (*UnimplementedRpcCrossChainServer) TxVerify

type UnimplementedRpcRelayChainServer

type UnimplementedRpcRelayChainServer struct {
}

UnimplementedRpcRelayChainServer can be embedded to have forward compatible implementations.

func (*UnimplementedRpcRelayChainServer) BeginCrossChain

func (*UnimplementedRpcRelayChainServer) GatewayRegister

func (*UnimplementedRpcRelayChainServer) GatewayUpdate

func (*UnimplementedRpcRelayChainServer) InitContract

func (*UnimplementedRpcRelayChainServer) QueryCrossChain

func (*UnimplementedRpcRelayChainServer) QueryGateway

func (*UnimplementedRpcRelayChainServer) SyncBlockHeader

func (*UnimplementedRpcRelayChainServer) UpdateContract

Jump to

Keyboard shortcuts

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