v1

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	PingResponse_ResultType_name = map[int32]string{
		0: "UNKNOWN",
		1: "Success",
		2: "Eror",
	}
	PingResponse_ResultType_value = map[string]int32{
		"UNKNOWN": 0,
		"Success": 1,
		"Eror":    2,
	}
)

Enum value maps for PingResponse_ResultType.

View Source
var File_v1_ping_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "io.thingz.grpc.v1.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Ping",
			Handler:    _Service_Ping_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Stream",
			Handler:       _Service_Stream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "v1/ping.proto",
}

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

Functions

func RegisterServiceHandler

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

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

func RegisterServiceHandlerClient

func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error

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

func RegisterServiceHandlerFromEndpoint

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

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

func RegisterServiceHandlerServer

func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error

RegisterServiceHandlerServer registers the http handlers for service Service to "mux". UnaryRPC :call ServiceServer 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 RegisterServiceHandlerFromEndpoint instead.

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Content

type Content struct {

	// Required. Message ID
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Required. Message content
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// Optional. Message metadata
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Content) Descriptor deprecated

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

Deprecated: Use Content.ProtoReflect.Descriptor instead.

func (*Content) GetData

func (x *Content) GetData() []byte

func (*Content) GetId

func (x *Content) GetId() string

func (*Content) GetMetadata

func (x *Content) GetMetadata() map[string]string

func (*Content) ProtoMessage

func (*Content) ProtoMessage()

func (*Content) ProtoReflect

func (x *Content) ProtoReflect() protoreflect.Message

func (*Content) Reset

func (x *Content) Reset()

func (*Content) String

func (x *Content) String() string

type PingRequest

type PingRequest struct {

	// Required. Represents ping content
	Content *Content `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	// Represents epoch based time when the message was sent
	Sent int64 `protobuf:"varint,2,opt,name=sent,proto3" json:"sent,omitempty"`
	// contains filtered or unexported fields
}

PingRequest represents the request message for Ping invocation.

func (*PingRequest) Descriptor deprecated

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

Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.

func (*PingRequest) GetContent

func (x *PingRequest) GetContent() *Content

func (*PingRequest) GetSent

func (x *PingRequest) GetSent() int64

func (*PingRequest) ProtoMessage

func (*PingRequest) ProtoMessage()

func (*PingRequest) ProtoReflect

func (x *PingRequest) ProtoReflect() protoreflect.Message

func (*PingRequest) Reset

func (x *PingRequest) Reset()

func (*PingRequest) String

func (x *PingRequest) String() string

type PingResponse

type PingResponse struct {

	// Represents request ID
	MessageID string `protobuf:"bytes,1,opt,name=messageID,proto3" json:"messageID,omitempty"`
	// Represents the count of messages
	MessageCount int64 `protobuf:"varint,2,opt,name=messageCount,proto3" json:"messageCount,omitempty"`
	// Represents the count of messages
	Processed int64 `protobuf:"varint,3,opt,name=processed,proto3" json:"processed,omitempty"`
	// Represents processing detail
	Detail string `protobuf:"bytes,4,opt,name=Detail,proto3" json:"Detail,omitempty"`
	// contains filtered or unexported fields
}

GetStateRequest is the message to get key-value states from specific state store.

func (*PingResponse) Descriptor deprecated

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

Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.

func (*PingResponse) GetDetail

func (x *PingResponse) GetDetail() string

func (*PingResponse) GetMessageCount

func (x *PingResponse) GetMessageCount() int64

func (*PingResponse) GetMessageID

func (x *PingResponse) GetMessageID() string

func (*PingResponse) GetProcessed

func (x *PingResponse) GetProcessed() int64

func (*PingResponse) ProtoMessage

func (*PingResponse) ProtoMessage()

func (*PingResponse) ProtoReflect

func (x *PingResponse) ProtoReflect() protoreflect.Message

func (*PingResponse) Reset

func (x *PingResponse) Reset()

func (*PingResponse) String

func (x *PingResponse) String() string

type PingResponse_ResultType

type PingResponse_ResultType int32
const (
	PingResponse_UNKNOWN PingResponse_ResultType = 0
	PingResponse_Success PingResponse_ResultType = 1
	PingResponse_Eror    PingResponse_ResultType = 2
)

func (PingResponse_ResultType) Descriptor

func (PingResponse_ResultType) Enum

func (PingResponse_ResultType) EnumDescriptor deprecated

func (PingResponse_ResultType) EnumDescriptor() ([]byte, []int)

Deprecated: Use PingResponse_ResultType.Descriptor instead.

func (PingResponse_ResultType) Number

func (PingResponse_ResultType) String

func (x PingResponse_ResultType) String() string

func (PingResponse_ResultType) Type

type ServiceClient

type ServiceClient interface {
	// Ping method on the service.
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
	// Stream is like Ping but with stream
	Stream(ctx context.Context, opts ...grpc.CallOption) (Service_StreamClient, error)
}

ServiceClient is the client API for Service 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.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// Ping method on the service.
	Ping(context.Context, *PingRequest) (*PingResponse, error)
	// Stream is like Ping but with stream
	Stream(Service_StreamServer) error
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Service_StreamClient

type Service_StreamClient interface {
	Send(*PingRequest) error
	Recv() (*PingResponse, error)
	grpc.ClientStream
}

type Service_StreamServer

type Service_StreamServer interface {
	Send(*PingResponse) error
	Recv() (*PingRequest, error)
	grpc.ServerStream
}

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) Ping

func (UnimplementedServiceServer) Stream

type UnsafeServiceServer

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

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

Jump to

Keyboard shortcuts

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