srv

package
v0.0.0-...-88c334c Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package srv is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	LedgerService_HealthCheck_FullMethodName     = "/srvpb.v1.LedgerService/HealthCheck"
	LedgerService_CreateAccount_FullMethodName   = "/srvpb.v1.LedgerService/CreateAccount"
	LedgerService_UpdateAccount_FullMethodName   = "/srvpb.v1.LedgerService/UpdateAccount"
	LedgerService_DeleteAccount_FullMethodName   = "/srvpb.v1.LedgerService/DeleteAccount"
	LedgerService_GetAccount_FullMethodName      = "/srvpb.v1.LedgerService/GetAccount"
	LedgerService_GetUserAccounts_FullMethodName = "/srvpb.v1.LedgerService/GetUserAccounts"
	LedgerService_Transfer_FullMethodName        = "/srvpb.v1.LedgerService/Transfer"
)

Variables

View Source
var File_srvpb_v1_oracle_proto protoreflect.FileDescriptor
View Source
var LedgerService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "srvpb.v1.LedgerService",
	HandlerType: (*LedgerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "HealthCheck",
			Handler:    _LedgerService_HealthCheck_Handler,
		},
		{
			MethodName: "CreateAccount",
			Handler:    _LedgerService_CreateAccount_Handler,
		},
		{
			MethodName: "UpdateAccount",
			Handler:    _LedgerService_UpdateAccount_Handler,
		},
		{
			MethodName: "DeleteAccount",
			Handler:    _LedgerService_DeleteAccount_Handler,
		},
		{
			MethodName: "GetAccount",
			Handler:    _LedgerService_GetAccount_Handler,
		},
		{
			MethodName: "GetUserAccounts",
			Handler:    _LedgerService_GetUserAccounts_Handler,
		},
		{
			MethodName: "Transfer",
			Handler:    _LedgerService_Transfer_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "srvpb/v1/oracle.proto",
}

LedgerService_ServiceDesc is the grpc.ServiceDesc for LedgerService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterLedgerServiceHandler

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

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

func RegisterLedgerServiceHandlerClient

func RegisterLedgerServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LedgerServiceClient) error

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

func RegisterLedgerServiceHandlerFromEndpoint

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

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

func RegisterLedgerServiceHandlerServer

func RegisterLedgerServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LedgerServiceServer) error

RegisterLedgerServiceHandlerServer registers the http handlers for service LedgerService to "mux". UnaryRPC :call LedgerServiceServer 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 RegisterLedgerServiceHandlerFromEndpoint instead.

func RegisterLedgerServiceServer

func RegisterLedgerServiceServer(s grpc.ServiceRegistrar, srv LedgerServiceServer)

Types

type LedgerServiceClient

type LedgerServiceClient interface {
	// Check the health of the service. This is used by load balancers to check service health.
	HealthCheck(ctx context.Context, in *v1.HealthCheckRequest, opts ...grpc.CallOption) (*v1.HealthCheckResponse, error)
	// Create a new account denominated in an underlying asset.
	CreateAccount(ctx context.Context, in *v1.CreateAccountRequest, opts ...grpc.CallOption) (*v1.CreateAccountResponse, error)
	// Update an account.
	UpdateAccount(ctx context.Context, in *v1.UpdateAccountRequest, opts ...grpc.CallOption) (*v1.UpdateAccountResponse, error)
	// Delete an account.
	DeleteAccount(ctx context.Context, in *v1.DeleteAccountRequest, opts ...grpc.CallOption) (*v1.DeleteAccountResponse, error)
	// Retrieve account details.
	GetAccount(ctx context.Context, in *v1.GetAccountRequest, opts ...grpc.CallOption) (*v1.GetAccountResponse, error)
	// Get accounts for a user.
	GetUserAccounts(ctx context.Context, in *v1.GetUserAccountsRequest, opts ...grpc.CallOption) (*v1.GetUserAccountsResponse, error)
	// Transfer between accounts denominated in the same underlying asset.
	Transfer(ctx context.Context, in *v1.TransferRequest, opts ...grpc.CallOption) (*v1.TransferResponse, error)
}

LedgerServiceClient is the client API for LedgerService service.

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 LedgerServiceServer

type LedgerServiceServer interface {
	// Check the health of the service. This is used by load balancers to check service health.
	HealthCheck(context.Context, *v1.HealthCheckRequest) (*v1.HealthCheckResponse, error)
	// Create a new account denominated in an underlying asset.
	CreateAccount(context.Context, *v1.CreateAccountRequest) (*v1.CreateAccountResponse, error)
	// Update an account.
	UpdateAccount(context.Context, *v1.UpdateAccountRequest) (*v1.UpdateAccountResponse, error)
	// Delete an account.
	DeleteAccount(context.Context, *v1.DeleteAccountRequest) (*v1.DeleteAccountResponse, error)
	// Retrieve account details.
	GetAccount(context.Context, *v1.GetAccountRequest) (*v1.GetAccountResponse, error)
	// Get accounts for a user.
	GetUserAccounts(context.Context, *v1.GetUserAccountsRequest) (*v1.GetUserAccountsResponse, error)
	// Transfer between accounts denominated in the same underlying asset.
	Transfer(context.Context, *v1.TransferRequest) (*v1.TransferResponse, error)
	// contains filtered or unexported methods
}

LedgerServiceServer is the server API for LedgerService service. All implementations must embed UnimplementedLedgerServiceServer for forward compatibility

type UnimplementedLedgerServiceServer

type UnimplementedLedgerServiceServer struct {
}

UnimplementedLedgerServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedLedgerServiceServer) CreateAccount

func (UnimplementedLedgerServiceServer) DeleteAccount

func (UnimplementedLedgerServiceServer) GetAccount

func (UnimplementedLedgerServiceServer) GetUserAccounts

func (UnimplementedLedgerServiceServer) HealthCheck

func (UnimplementedLedgerServiceServer) Transfer

func (UnimplementedLedgerServiceServer) UpdateAccount

type UnsafeLedgerServiceServer

type UnsafeLedgerServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeLedgerServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to LedgerServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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