protocol

package
v0.0.0-...-581116b Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RecommendationMode_name = map[int32]string{
		0: "GetFarthest",
		1: "GetNearest",
	}
	RecommendationMode_value = map[string]int32{
		"GetFarthest": 0,
		"GetNearest":  1,
	}
)

Enum value maps for RecommendationMode.

View Source
var File_route_proto protoreflect.FileDescriptor
View Source
var RouteGuide_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "protocol.RouteGuide",
	HandlerType: (*RouteGuideServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetFeatures",
			Handler:    _RouteGuide_GetFeatures_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ListFeatures",
			Handler:       _RouteGuide_ListFeatures_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "RecordRoute",
			Handler:       _RouteGuide_RecordRoute_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "Recommend",
			Handler:       _RouteGuide_Recommend_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "route.proto",
}

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

Functions

func RegisterRouteGuideServer

func RegisterRouteGuideServer(s grpc.ServiceRegistrar, srv RouteGuideServer)

Types

type Feature

type Feature struct {
	Name     string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Location *Point `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
	// contains filtered or unexported fields
}

func (*Feature) Descriptor deprecated

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

Deprecated: Use Feature.ProtoReflect.Descriptor instead.

func (*Feature) GetLocation

func (x *Feature) GetLocation() *Point

func (*Feature) GetName

func (x *Feature) GetName() string

func (*Feature) ProtoMessage

func (*Feature) ProtoMessage()

func (*Feature) ProtoReflect

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

func (*Feature) Reset

func (x *Feature) Reset()

func (*Feature) String

func (x *Feature) String() string

type Point

type Point struct {
	Latitude  int32 `protobuf:"varint,1,opt,name=latitude,proto3" json:"latitude,omitempty"`   // 纬度
	Longitude int32 `protobuf:"varint,2,opt,name=longitude,proto3" json:"longitude,omitempty"` // 经度
	// contains filtered or unexported fields
}

func (*Point) Descriptor deprecated

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

Deprecated: Use Point.ProtoReflect.Descriptor instead.

func (*Point) GetLatitude

func (x *Point) GetLatitude() int32

func (*Point) GetLongitude

func (x *Point) GetLongitude() int32

func (*Point) ProtoMessage

func (*Point) ProtoMessage()

func (*Point) ProtoReflect

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

func (*Point) Reset

func (x *Point) Reset()

func (*Point) String

func (x *Point) String() string

type RecommendationMode

type RecommendationMode int32
const (
	RecommendationMode_GetFarthest RecommendationMode = 0
	RecommendationMode_GetNearest  RecommendationMode = 1
)

func (RecommendationMode) Descriptor

func (RecommendationMode) Enum

func (RecommendationMode) EnumDescriptor deprecated

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

Deprecated: Use RecommendationMode.Descriptor instead.

func (RecommendationMode) Number

func (RecommendationMode) String

func (x RecommendationMode) String() string

func (RecommendationMode) Type

type RecommendationRequest

type RecommendationRequest struct {
	Mode  RecommendationMode `protobuf:"varint,1,opt,name=mode,proto3,enum=protocol.RecommendationMode" json:"mode,omitempty"` // 推荐模式
	Point *Point             `protobuf:"bytes,2,opt,name=point,proto3" json:"point,omitempty"`                                 // 点
	// contains filtered or unexported fields
}

func (*RecommendationRequest) Descriptor deprecated

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

Deprecated: Use RecommendationRequest.ProtoReflect.Descriptor instead.

func (*RecommendationRequest) GetMode

func (*RecommendationRequest) GetPoint

func (x *RecommendationRequest) GetPoint() *Point

func (*RecommendationRequest) ProtoMessage

func (*RecommendationRequest) ProtoMessage()

func (*RecommendationRequest) ProtoReflect

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

func (*RecommendationRequest) Reset

func (x *RecommendationRequest) Reset()

func (*RecommendationRequest) String

func (x *RecommendationRequest) String() string

type Rectangle

type Rectangle struct {
	Lo *Point `protobuf:"bytes,1,opt,name=lo,proto3" json:"lo,omitempty"`
	Hi *Point `protobuf:"bytes,2,opt,name=hi,proto3" json:"hi,omitempty"`
	// contains filtered or unexported fields
}

func (*Rectangle) Descriptor deprecated

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

Deprecated: Use Rectangle.ProtoReflect.Descriptor instead.

func (*Rectangle) GetHi

func (x *Rectangle) GetHi() *Point

func (*Rectangle) GetLo

func (x *Rectangle) GetLo() *Point

func (*Rectangle) ProtoMessage

func (*Rectangle) ProtoMessage()

func (*Rectangle) ProtoReflect

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

func (*Rectangle) Reset

func (x *Rectangle) Reset()

func (*Rectangle) String

func (x *Rectangle) String() string

type RouteGuideClient

type RouteGuideClient interface {
	// unary
	GetFeatures(ctx context.Context, in *Point, opts ...grpc.CallOption) (*Feature, error)
	// server side streaming
	ListFeatures(ctx context.Context, in *Rectangle, opts ...grpc.CallOption) (RouteGuide_ListFeaturesClient, error)
	// client side streaming
	RecordRoute(ctx context.Context, opts ...grpc.CallOption) (RouteGuide_RecordRouteClient, error)
	// bidirectional streaming
	Recommend(ctx context.Context, opts ...grpc.CallOption) (RouteGuide_RecommendClient, error)
}

RouteGuideClient is the client API for RouteGuide 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 NewRouteGuideClient

func NewRouteGuideClient(cc grpc.ClientConnInterface) RouteGuideClient

type RouteGuideServer

type RouteGuideServer interface {
	// unary
	GetFeatures(context.Context, *Point) (*Feature, error)
	// server side streaming
	ListFeatures(*Rectangle, RouteGuide_ListFeaturesServer) error
	// client side streaming
	RecordRoute(RouteGuide_RecordRouteServer) error
	// bidirectional streaming
	Recommend(RouteGuide_RecommendServer) error
	// contains filtered or unexported methods
}

RouteGuideServer is the server API for RouteGuide service. All implementations must embed UnimplementedRouteGuideServer for forward compatibility

type RouteGuide_ListFeaturesClient

type RouteGuide_ListFeaturesClient interface {
	Recv() (*Feature, error)
	grpc.ClientStream
}

type RouteGuide_ListFeaturesServer

type RouteGuide_ListFeaturesServer interface {
	Send(*Feature) error
	grpc.ServerStream
}

type RouteGuide_RecommendClient

type RouteGuide_RecommendClient interface {
	Send(*RecommendationRequest) error
	Recv() (*Feature, error)
	grpc.ClientStream
}

type RouteGuide_RecommendServer

type RouteGuide_RecommendServer interface {
	Send(*Feature) error
	Recv() (*RecommendationRequest, error)
	grpc.ServerStream
}

type RouteGuide_RecordRouteClient

type RouteGuide_RecordRouteClient interface {
	Send(*Point) error
	CloseAndRecv() (*RouteSummary, error)
	grpc.ClientStream
}

type RouteGuide_RecordRouteServer

type RouteGuide_RecordRouteServer interface {
	SendAndClose(*RouteSummary) error
	Recv() (*Point, error)
	grpc.ServerStream
}

type RouteSummary

type RouteSummary struct {
	PointCount  int32 `protobuf:"varint,1,opt,name=point_count,json=pointCount,proto3" json:"point_count,omitempty"`
	Distance    int32 `protobuf:"varint,2,opt,name=distance,proto3" json:"distance,omitempty"` // 距离
	ElapsedTime int32 `protobuf:"varint,3,opt,name=elapsed_time,json=elapsedTime,proto3" json:"elapsed_time,omitempty"`
	// contains filtered or unexported fields
}

func (*RouteSummary) Descriptor deprecated

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

Deprecated: Use RouteSummary.ProtoReflect.Descriptor instead.

func (*RouteSummary) GetDistance

func (x *RouteSummary) GetDistance() int32

func (*RouteSummary) GetElapsedTime

func (x *RouteSummary) GetElapsedTime() int32

func (*RouteSummary) GetPointCount

func (x *RouteSummary) GetPointCount() int32

func (*RouteSummary) ProtoMessage

func (*RouteSummary) ProtoMessage()

func (*RouteSummary) ProtoReflect

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

func (*RouteSummary) Reset

func (x *RouteSummary) Reset()

func (*RouteSummary) String

func (x *RouteSummary) String() string

type UnimplementedRouteGuideServer

type UnimplementedRouteGuideServer struct {
}

UnimplementedRouteGuideServer must be embedded to have forward compatible implementations.

func (UnimplementedRouteGuideServer) GetFeatures

func (UnimplementedRouteGuideServer) ListFeatures

func (UnimplementedRouteGuideServer) Recommend

func (UnimplementedRouteGuideServer) RecordRoute

type UnsafeRouteGuideServer

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

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

Jump to

Keyboard shortcuts

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