service

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package service is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthService        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowService          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterOracleHandler

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

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

func RegisterOracleHandlerClient

func RegisterOracleHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OracleClient) error

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

func RegisterOracleHandlerFromEndpoint

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

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

func RegisterOracleHandlerServer

func RegisterOracleHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OracleServer) error

RegisterOracleHandlerServer registers the http handlers for service Oracle to "mux". UnaryRPC :call OracleServer 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 RegisterOracleHandlerFromEndpoint instead.

func RegisterOracleServer

func RegisterOracleServer(s grpc1.Server, srv OracleServer)

Types

type OracleClient

type OracleClient interface {
	// Prices defines a method for fetching the latest prices.
	Prices(ctx context.Context, in *QueryPricesRequest, opts ...grpc.CallOption) (*QueryPricesResponse, error)
}

OracleClient is the client API for Oracle service.

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

func NewOracleClient

func NewOracleClient(cc grpc1.ClientConn) OracleClient

type OracleServer

type OracleServer interface {
	// Prices defines a method for fetching the latest prices.
	Prices(context.Context, *QueryPricesRequest) (*QueryPricesResponse, error)
}

OracleServer is the server API for Oracle service.

type OracleService

type OracleService interface {
	OracleServer

	Start(context.Context) error
	Stop(context.Context) error
}

OracleService defines the service all clients must implement.

type QueryPricesRequest

type QueryPricesRequest struct {
}

QueryPricesRequest defines the request type for the the Prices method.

func (*QueryPricesRequest) Descriptor

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

func (*QueryPricesRequest) Marshal

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

func (*QueryPricesRequest) MarshalTo

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

func (*QueryPricesRequest) MarshalToSizedBuffer

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

func (*QueryPricesRequest) ProtoMessage

func (*QueryPricesRequest) ProtoMessage()

func (*QueryPricesRequest) Reset

func (m *QueryPricesRequest) Reset()

func (*QueryPricesRequest) Size

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

func (*QueryPricesRequest) String

func (m *QueryPricesRequest) String() string

func (*QueryPricesRequest) Unmarshal

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

func (*QueryPricesRequest) XXX_DiscardUnknown

func (m *QueryPricesRequest) XXX_DiscardUnknown()

func (*QueryPricesRequest) XXX_Marshal

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

func (*QueryPricesRequest) XXX_Merge

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

func (*QueryPricesRequest) XXX_Size

func (m *QueryPricesRequest) XXX_Size() int

func (*QueryPricesRequest) XXX_Unmarshal

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

type QueryPricesResponse

type QueryPricesResponse struct {
	// prices defines the list of prices.
	Prices    map[string]string `` /* 143-byte string literal not displayed */
	Timestamp time.Time         `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"`
}

QueryPricesResponse defines the response type for the Prices method.

func (*QueryPricesResponse) Descriptor

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

func (*QueryPricesResponse) GetPrices

func (m *QueryPricesResponse) GetPrices() map[string]string

func (*QueryPricesResponse) GetTimestamp

func (m *QueryPricesResponse) GetTimestamp() time.Time

func (*QueryPricesResponse) Marshal

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

func (*QueryPricesResponse) MarshalTo

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

func (*QueryPricesResponse) MarshalToSizedBuffer

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

func (*QueryPricesResponse) ProtoMessage

func (*QueryPricesResponse) ProtoMessage()

func (*QueryPricesResponse) Reset

func (m *QueryPricesResponse) Reset()

func (*QueryPricesResponse) Size

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

func (*QueryPricesResponse) String

func (m *QueryPricesResponse) String() string

func (*QueryPricesResponse) Unmarshal

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

func (*QueryPricesResponse) XXX_DiscardUnknown

func (m *QueryPricesResponse) XXX_DiscardUnknown()

func (*QueryPricesResponse) XXX_Marshal

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

func (*QueryPricesResponse) XXX_Merge

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

func (*QueryPricesResponse) XXX_Size

func (m *QueryPricesResponse) XXX_Size() int

func (*QueryPricesResponse) XXX_Unmarshal

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

type UnimplementedOracleServer

type UnimplementedOracleServer struct {
}

UnimplementedOracleServer can be embedded to have forward compatible implementations.

func (*UnimplementedOracleServer) Prices

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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