service

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FeedType_name = map[int32]string{
		0: "FEED_TYPE_UNKNOWN",
		1: "FEED_TYPE_RED",
		2: "FEED_TYPE_BLUE",
	}
	FeedType_value = map[string]int32{
		"FEED_TYPE_UNKNOWN": 0,
		"FEED_TYPE_RED":     1,
		"FEED_TYPE_BLUE":    2,
	}
)

Enum value maps for FeedType.

View Source
var File_service_proto protoreflect.FileDescriptor

Functions

func RegisterAppServer

func RegisterAppServer(s *grpc.Server, srv AppServer)

func RegisterExposedAppServer

func RegisterExposedAppServer(s *grpc.Server, srv ExposedAppServer)

Types

type AppClient

type AppClient interface {
	// Fibonacci returns the nth number in the Fibonacci sequence. It does not start with an HTTP method and is therefore not exposed
	Fibonacci(ctx context.Context, in *FibonacciRequest, opts ...grpc.CallOption) (*FibonacciResponse, error)
	// Random returns a random integer in the desired range. It may be accessed via a Get request to the proxy at, for example, /api/Service/Random
	Random(ctx context.Context, in *RandomRequest, opts ...grpc.CallOption) (*RandomResponse, error)
	// UploadPhoto allows the upload of a photo to some persistence store. It may be accessed via  Post request to the proxy at, for example, /api/Service/UploadPhoto
	UploadPhoto(ctx context.Context, in *UploadPhotoRequest, opts ...grpc.CallOption) (*UploadPhotoResponse, error)
	// Feed sends streamed inputs
	Feed(ctx context.Context, opts ...grpc.CallOption) (App_FeedClient, error)
	// Broadcast asks the App to broadcast data in a stream
	Broadcast(ctx context.Context, in *BroadcastRequest, opts ...grpc.CallOption) (App_BroadcastClient, error)
	// ConvertToString streams conversions of the input stream to strings
	ConvertToString(ctx context.Context, opts ...grpc.CallOption) (App_ConvertToStringClient, error)
}

AppClient is the client API for App 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 NewAppClient

func NewAppClient(cc grpc.ClientConnInterface) AppClient

type AppServer

type AppServer interface {
	// Fibonacci returns the nth number in the Fibonacci sequence. It does not start with an HTTP method and is therefore not exposed
	Fibonacci(context.Context, *FibonacciRequest) (*FibonacciResponse, error)
	// Random returns a random integer in the desired range. It may be accessed via a Get request to the proxy at, for example, /api/Service/Random
	Random(context.Context, *RandomRequest) (*RandomResponse, error)
	// UploadPhoto allows the upload of a photo to some persistence store. It may be accessed via  Post request to the proxy at, for example, /api/Service/UploadPhoto
	UploadPhoto(context.Context, *UploadPhotoRequest) (*UploadPhotoResponse, error)
	// Feed sends streamed inputs
	Feed(App_FeedServer) error
	// Broadcast asks the App to broadcast data in a stream
	Broadcast(*BroadcastRequest, App_BroadcastServer) error
	// ConvertToString streams conversions of the input stream to strings
	ConvertToString(App_ConvertToStringServer) error
	// contains filtered or unexported methods
}

AppServer is the server API for App service. All implementations must embed UnimplementedAppServer for forward compatibility

type App_BroadcastClient

type App_BroadcastClient interface {
	Recv() (*BroadcastData, error)
	grpc.ClientStream
}

type App_BroadcastServer

type App_BroadcastServer interface {
	Send(*BroadcastData) error
	grpc.ServerStream
}

type App_ConvertToStringClient

type App_ConvertToStringClient interface {
	Send(*ConvertInput) error
	Recv() (*ConvertOutput, error)
	grpc.ClientStream
}

type App_ConvertToStringServer

type App_ConvertToStringServer interface {
	Send(*ConvertOutput) error
	Recv() (*ConvertInput, error)
	grpc.ServerStream
}

type App_FeedClient

type App_FeedClient interface {
	Send(*FeedData) error
	CloseAndRecv() (*FeedResponse, error)
	grpc.ClientStream
}

type App_FeedServer

type App_FeedServer interface {
	SendAndClose(*FeedResponse) error
	Recv() (*FeedData, error)
	grpc.ServerStream
}

type BroadcastData

type BroadcastData struct {
	RawData []byte `protobuf:"bytes,1,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"`
	// contains filtered or unexported fields
}

func (*BroadcastData) Descriptor deprecated

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

Deprecated: Use BroadcastData.ProtoReflect.Descriptor instead.

func (*BroadcastData) GetRawData

func (x *BroadcastData) GetRawData() []byte

func (*BroadcastData) ProtoMessage

func (*BroadcastData) ProtoMessage()

func (*BroadcastData) ProtoReflect

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

func (*BroadcastData) Reset

func (x *BroadcastData) Reset()

func (*BroadcastData) String

func (x *BroadcastData) String() string

type BroadcastRequest

type BroadcastRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*BroadcastRequest) Descriptor deprecated

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

Deprecated: Use BroadcastRequest.ProtoReflect.Descriptor instead.

func (*BroadcastRequest) GetId

func (x *BroadcastRequest) GetId() string

func (*BroadcastRequest) ProtoMessage

func (*BroadcastRequest) ProtoMessage()

func (*BroadcastRequest) ProtoReflect

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

func (*BroadcastRequest) Reset

func (x *BroadcastRequest) Reset()

func (*BroadcastRequest) String

func (x *BroadcastRequest) String() string

type ConvertInput

type ConvertInput struct {
	RawData []byte `protobuf:"bytes,1,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"`
	// contains filtered or unexported fields
}

func (*ConvertInput) Descriptor deprecated

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

Deprecated: Use ConvertInput.ProtoReflect.Descriptor instead.

func (*ConvertInput) GetRawData

func (x *ConvertInput) GetRawData() []byte

func (*ConvertInput) ProtoMessage

func (*ConvertInput) ProtoMessage()

func (*ConvertInput) ProtoReflect

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

func (*ConvertInput) Reset

func (x *ConvertInput) Reset()

func (*ConvertInput) String

func (x *ConvertInput) String() string

type ConvertOutput

type ConvertOutput struct {
	ConvertedData string `protobuf:"bytes,1,opt,name=converted_data,json=convertedData,proto3" json:"converted_data,omitempty"`
	// contains filtered or unexported fields
}

func (*ConvertOutput) Descriptor deprecated

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

Deprecated: Use ConvertOutput.ProtoReflect.Descriptor instead.

func (*ConvertOutput) GetConvertedData

func (x *ConvertOutput) GetConvertedData() string

func (*ConvertOutput) ProtoMessage

func (*ConvertOutput) ProtoMessage()

func (*ConvertOutput) ProtoReflect

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

func (*ConvertOutput) Reset

func (x *ConvertOutput) Reset()

func (*ConvertOutput) String

func (x *ConvertOutput) String() string

type ExposedAppClient

type ExposedAppClient interface {
	GetRandom(ctx context.Context, in *RandomRequest, opts ...grpc.CallOption) (*RandomResponse, error)
	PostUploadPhoto(ctx context.Context, in *UploadPhotoRequest, opts ...grpc.CallOption) (*UploadPhotoResponse, error)
	GetFeed(ctx context.Context, opts ...grpc.CallOption) (ExposedApp_GetFeedClient, error)
	GetBroadcast(ctx context.Context, in *BroadcastRequest, opts ...grpc.CallOption) (ExposedApp_GetBroadcastClient, error)
	GetConvertToString(ctx context.Context, opts ...grpc.CallOption) (ExposedApp_GetConvertToStringClient, error)
}

ExposedAppClient is the client API for ExposedApp 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 NewExposedAppClient

func NewExposedAppClient(cc grpc.ClientConnInterface) ExposedAppClient

type ExposedAppServer

type ExposedAppServer interface {
	GetRandom(context.Context, *RandomRequest) (*RandomResponse, error)
	PostUploadPhoto(context.Context, *UploadPhotoRequest) (*UploadPhotoResponse, error)
	GetFeed(ExposedApp_GetFeedServer) error
	GetBroadcast(*BroadcastRequest, ExposedApp_GetBroadcastServer) error
	GetConvertToString(ExposedApp_GetConvertToStringServer) error
	// contains filtered or unexported methods
}

ExposedAppServer is the server API for ExposedApp service. All implementations must embed UnimplementedExposedAppServer for forward compatibility

type ExposedApp_GetBroadcastClient

type ExposedApp_GetBroadcastClient interface {
	Recv() (*BroadcastData, error)
	grpc.ClientStream
}

type ExposedApp_GetBroadcastServer

type ExposedApp_GetBroadcastServer interface {
	Send(*BroadcastData) error
	grpc.ServerStream
}

type ExposedApp_GetConvertToStringClient

type ExposedApp_GetConvertToStringClient interface {
	Send(*ConvertInput) error
	Recv() (*ConvertOutput, error)
	grpc.ClientStream
}

type ExposedApp_GetConvertToStringServer

type ExposedApp_GetConvertToStringServer interface {
	Send(*ConvertOutput) error
	Recv() (*ConvertInput, error)
	grpc.ServerStream
}

type ExposedApp_GetFeedClient

type ExposedApp_GetFeedClient interface {
	Send(*FeedData) error
	CloseAndRecv() (*FeedResponse, error)
	grpc.ClientStream
}

type ExposedApp_GetFeedServer

type ExposedApp_GetFeedServer interface {
	SendAndClose(*FeedResponse) error
	Recv() (*FeedData, error)
	grpc.ServerStream
}

type FeedData

type FeedData struct {
	Id       string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	DataType uint64   `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"`
	RawData  []byte   `protobuf:"bytes,3,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"`
	Type     FeedType `protobuf:"varint,4,opt,name=type,proto3,enum=service.FeedType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*FeedData) Descriptor deprecated

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

Deprecated: Use FeedData.ProtoReflect.Descriptor instead.

func (*FeedData) GetDataType

func (x *FeedData) GetDataType() uint64

func (*FeedData) GetId

func (x *FeedData) GetId() string

func (*FeedData) GetRawData

func (x *FeedData) GetRawData() []byte

func (*FeedData) GetType

func (x *FeedData) GetType() FeedType

func (*FeedData) ProtoMessage

func (*FeedData) ProtoMessage()

func (*FeedData) ProtoReflect

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

func (*FeedData) Reset

func (x *FeedData) Reset()

func (*FeedData) String

func (x *FeedData) String() string

type FeedResponse

type FeedResponse struct {
	Received int32 `protobuf:"varint,1,opt,name=received,proto3" json:"received,omitempty"`
	// contains filtered or unexported fields
}

func (*FeedResponse) Descriptor deprecated

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

Deprecated: Use FeedResponse.ProtoReflect.Descriptor instead.

func (*FeedResponse) GetReceived

func (x *FeedResponse) GetReceived() int32

func (*FeedResponse) ProtoMessage

func (*FeedResponse) ProtoMessage()

func (*FeedResponse) ProtoReflect

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

func (*FeedResponse) Reset

func (x *FeedResponse) Reset()

func (*FeedResponse) String

func (x *FeedResponse) String() string

type FeedType

type FeedType int32
const (
	FeedType_FEED_TYPE_UNKNOWN FeedType = 0
	FeedType_FEED_TYPE_RED     FeedType = 1
	FeedType_FEED_TYPE_BLUE    FeedType = 2
)

func (FeedType) Descriptor

func (FeedType) Descriptor() protoreflect.EnumDescriptor

func (FeedType) Enum

func (x FeedType) Enum() *FeedType

func (FeedType) EnumDescriptor deprecated

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

Deprecated: Use FeedType.Descriptor instead.

func (FeedType) Number

func (x FeedType) Number() protoreflect.EnumNumber

func (FeedType) String

func (x FeedType) String() string

func (FeedType) Type

type FibonacciRequest

type FibonacciRequest struct {

	// The 1-indexed point in the Fibonacci sequence
	N uint64 `protobuf:"varint,1,opt,name=n,proto3" json:"n,omitempty"`
	// contains filtered or unexported fields
}

func (*FibonacciRequest) Descriptor deprecated

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

Deprecated: Use FibonacciRequest.ProtoReflect.Descriptor instead.

func (*FibonacciRequest) GetN

func (x *FibonacciRequest) GetN() uint64

func (*FibonacciRequest) ProtoMessage

func (*FibonacciRequest) ProtoMessage()

func (*FibonacciRequest) ProtoReflect

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

func (*FibonacciRequest) Reset

func (x *FibonacciRequest) Reset()

func (*FibonacciRequest) String

func (x *FibonacciRequest) String() string

type FibonacciResponse

type FibonacciResponse struct {

	// The number found in the nth place of the sequence
	Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	// contains filtered or unexported fields
}

func (*FibonacciResponse) Descriptor deprecated

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

Deprecated: Use FibonacciResponse.ProtoReflect.Descriptor instead.

func (*FibonacciResponse) GetNumber

func (x *FibonacciResponse) GetNumber() uint64

func (*FibonacciResponse) ProtoMessage

func (*FibonacciResponse) ProtoMessage()

func (*FibonacciResponse) ProtoReflect

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

func (*FibonacciResponse) Reset

func (x *FibonacciResponse) Reset()

func (*FibonacciResponse) String

func (x *FibonacciResponse) String() string

type Handle

type Handle struct {
	UnimplementedAppServer
	// contains filtered or unexported fields
}

Handle is an example GRPC server for a microservice

func New

func New() (*Handle, error)

New creates a new server

func (*Handle) Broadcast

func (h *Handle) Broadcast(in *BroadcastRequest, stream App_BroadcastServer) error

Broadcast asks the App to broadcast data in a stream

func (*Handle) ConvertToString

func (h *Handle) ConvertToString(stream App_ConvertToStringServer) error

ConvertToString streams conversions of the input stream to strings

func (*Handle) Feed

func (h *Handle) Feed(stream App_FeedServer) error

Feed handles streamed inputs

func (*Handle) Fibonacci

func (h *Handle) Fibonacci(ctx context.Context, in *FibonacciRequest) (*FibonacciResponse, error)

Fibonacci returns the nth number in the Fibonacci sequence. It does not start with an HTTP method and is therefore not exposed

func (*Handle) MakeClientConn

func (h *Handle) MakeClientConn() (*grpc.ClientConn, error)

MakeClientConn returns a client connection to this service

func (*Handle) Random

func (h *Handle) Random(ctx context.Context, in *RandomRequest) (*RandomResponse, error)

Random returns a random integer in the desired range. It may be accessed via a Get request to the proxy at, for example, /api/Service/Random

func (*Handle) Start

func (h *Handle) Start() error

Start starts the server

func (*Handle) Stop

func (h *Handle) Stop()

Stop stops the server

func (*Handle) UploadPhoto

func (h *Handle) UploadPhoto(ctx context.Context, in *UploadPhotoRequest) (*UploadPhotoResponse, error)

UploadPhoto allows the upload of a photo to some persistence store. It may be accessed via Post request to the proxy at, for example, /api/Service/UploadPhoto

type RandomRequest

type RandomRequest struct {

	// The lowest inclusive integer for the resulting random number
	LowerBound int64 `protobuf:"varint,1,opt,name=lower_bound,json=lowerBound,proto3" json:"lower_bound,omitempty"`
	// The highest inclusive integer for the resulting random number
	UpperBound int64 `protobuf:"varint,2,opt,name=upper_bound,json=upperBound,proto3" json:"upper_bound,omitempty"`
	// contains filtered or unexported fields
}

func (*RandomRequest) Descriptor deprecated

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

Deprecated: Use RandomRequest.ProtoReflect.Descriptor instead.

func (*RandomRequest) GetLowerBound

func (x *RandomRequest) GetLowerBound() int64

func (*RandomRequest) GetUpperBound

func (x *RandomRequest) GetUpperBound() int64

func (*RandomRequest) ProtoMessage

func (*RandomRequest) ProtoMessage()

func (*RandomRequest) ProtoReflect

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

func (*RandomRequest) Reset

func (x *RandomRequest) Reset()

func (*RandomRequest) String

func (x *RandomRequest) String() string

type RandomResponse

type RandomResponse struct {

	// The generated number
	Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	// contains filtered or unexported fields
}

func (*RandomResponse) Descriptor deprecated

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

Deprecated: Use RandomResponse.ProtoReflect.Descriptor instead.

func (*RandomResponse) GetNumber

func (x *RandomResponse) GetNumber() int64

func (*RandomResponse) ProtoMessage

func (*RandomResponse) ProtoMessage()

func (*RandomResponse) ProtoReflect

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

func (*RandomResponse) Reset

func (x *RandomResponse) Reset()

func (*RandomResponse) String

func (x *RandomResponse) String() string

type UnimplementedAppServer

type UnimplementedAppServer struct {
}

UnimplementedAppServer must be embedded to have forward compatible implementations.

func (UnimplementedAppServer) Broadcast

func (UnimplementedAppServer) ConvertToString

func (UnimplementedAppServer) Feed

func (UnimplementedAppServer) Fibonacci

func (UnimplementedAppServer) Random

func (UnimplementedAppServer) UploadPhoto

type UnimplementedExposedAppServer

type UnimplementedExposedAppServer struct {
}

UnimplementedExposedAppServer must be embedded to have forward compatible implementations.

func (UnimplementedExposedAppServer) GetBroadcast

func (UnimplementedExposedAppServer) GetConvertToString

func (UnimplementedExposedAppServer) GetFeed

func (UnimplementedExposedAppServer) GetRandom

func (UnimplementedExposedAppServer) PostUploadPhoto

type UnsafeAppServer

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

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

type UnsafeExposedAppServer

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

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

type UploadPhotoRequest

type UploadPhotoRequest struct {

	// The raw bytes of the photo
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*UploadPhotoRequest) Descriptor deprecated

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

Deprecated: Use UploadPhotoRequest.ProtoReflect.Descriptor instead.

func (*UploadPhotoRequest) GetData

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

func (*UploadPhotoRequest) ProtoMessage

func (*UploadPhotoRequest) ProtoMessage()

func (*UploadPhotoRequest) ProtoReflect

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

func (*UploadPhotoRequest) Reset

func (x *UploadPhotoRequest) Reset()

func (*UploadPhotoRequest) String

func (x *UploadPhotoRequest) String() string

type UploadPhotoResponse

type UploadPhotoResponse struct {

	// The uuid generated to identify and retreive this photo
	Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// contains filtered or unexported fields
}

func (*UploadPhotoResponse) Descriptor deprecated

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

Deprecated: Use UploadPhotoResponse.ProtoReflect.Descriptor instead.

func (*UploadPhotoResponse) GetUuid

func (x *UploadPhotoResponse) GetUuid() string

func (*UploadPhotoResponse) ProtoMessage

func (*UploadPhotoResponse) ProtoMessage()

func (*UploadPhotoResponse) ProtoReflect

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

func (*UploadPhotoResponse) Reset

func (x *UploadPhotoResponse) Reset()

func (*UploadPhotoResponse) String

func (x *UploadPhotoResponse) String() string

Jump to

Keyboard shortcuts

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