grpcapi

package
v0.0.0-...-c2add7f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package grpcapi provides protobuf bindings to use with gRPC and various helper functions.

Index

Constants

This section is empty.

Variables

View Source
var File_health_proto protoreflect.FileDescriptor
View Source
var File_metrics_proto protoreflect.FileDescriptor
View Source
var Health_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "metrics.collector.v1.Health",
	HandlerType: (*HealthServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Ping",
			Handler:    _Health_Ping_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "health.proto",
}

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

View Source
var Metrics_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "metrics.collector.v1.Metrics",
	HandlerType: (*MetricsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Update",
			Handler:    _Metrics_Update_Handler,
		},
		{
			MethodName: "BatchUpdate",
			Handler:    _Metrics_BatchUpdate_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _Metrics_Get_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "metrics.proto",
}

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

Functions

func RegisterHealthServer

func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer)

func RegisterMetricsServer

func RegisterMetricsServer(s grpc.ServiceRegistrar, srv MetricsServer)

Types

type BatchUpdateRequest

type BatchUpdateRequest struct {
	Data []*MetricReq `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*BatchUpdateRequest) Descriptor deprecated

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

Deprecated: Use BatchUpdateRequest.ProtoReflect.Descriptor instead.

func (*BatchUpdateRequest) GetData

func (x *BatchUpdateRequest) GetData() []*MetricReq

func (*BatchUpdateRequest) ProtoMessage

func (*BatchUpdateRequest) ProtoMessage()

func (*BatchUpdateRequest) ProtoReflect

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

func (*BatchUpdateRequest) Reset

func (x *BatchUpdateRequest) Reset()

func (*BatchUpdateRequest) String

func (x *BatchUpdateRequest) String() string

type BatchUpdateResponse

type BatchUpdateResponse struct {
	Data []*MetricReq `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*BatchUpdateResponse) Descriptor deprecated

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

Deprecated: Use BatchUpdateResponse.ProtoReflect.Descriptor instead.

func (*BatchUpdateResponse) GetData

func (x *BatchUpdateResponse) GetData() []*MetricReq

func (*BatchUpdateResponse) ProtoMessage

func (*BatchUpdateResponse) ProtoMessage()

func (*BatchUpdateResponse) ProtoReflect

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

func (*BatchUpdateResponse) Reset

func (x *BatchUpdateResponse) Reset()

func (*BatchUpdateResponse) String

func (x *BatchUpdateResponse) String() string

type GetMetricRequest

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

func NewGetCounterReq

func NewGetCounterReq(name string) *GetMetricRequest

NewGetCounterReq creates new GetMetricRequest structure to be used for retrieving of counter metric.

func NewGetGaugeReq

func NewGetGaugeReq(name string) *GetMetricRequest

NewGetGaugeReq creates new GetMetricRequest structure to be used for retrieving of gauge metric.

func (*GetMetricRequest) Descriptor deprecated

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

Deprecated: Use GetMetricRequest.ProtoReflect.Descriptor instead.

func (*GetMetricRequest) GetId

func (x *GetMetricRequest) GetId() string

func (*GetMetricRequest) GetMtype

func (x *GetMetricRequest) GetMtype() string

func (*GetMetricRequest) ProtoMessage

func (*GetMetricRequest) ProtoMessage()

func (*GetMetricRequest) ProtoReflect

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

func (*GetMetricRequest) Reset

func (x *GetMetricRequest) Reset()

func (*GetMetricRequest) String

func (x *GetMetricRequest) String() string

type HealthClient

type HealthClient interface {
	Ping(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

HealthClient is the client API for Health 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 NewHealthClient

func NewHealthClient(cc grpc.ClientConnInterface) HealthClient

type HealthServer

type HealthServer interface {
	Ping(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

HealthServer is the server API for Health service. All implementations must embed UnimplementedHealthServer for forward compatibility

type MetricReq

type MetricReq struct {
	Id    string  `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Mtype string  `protobuf:"bytes,2,opt,name=mtype,proto3" json:"mtype,omitempty"`
	Delta int64   `protobuf:"varint,3,opt,name=delta,proto3" json:"delta,omitempty"`
	Value float64 `protobuf:"fixed64,4,opt,name=value,proto3" json:"value,omitempty"`
	Hash  string  `protobuf:"bytes,5,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

NB (alkurbatov): The name was intentionally choosen to match the similar structure from HTTP API for convenience.

func NewUpdateCounterReq

func NewUpdateCounterReq(name string, value metrics.Counter) *MetricReq

NewUpdateCounterReq creates new MetricReq structure to be used for updating counter metric.

func NewUpdateGaugeReq

func NewUpdateGaugeReq(name string, value metrics.Gauge) *MetricReq

NewUpdateGaugeReq creates new MetricReq structure to be used for updating gauge metric.

func (*MetricReq) Descriptor deprecated

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

Deprecated: Use MetricReq.ProtoReflect.Descriptor instead.

func (*MetricReq) GetDelta

func (x *MetricReq) GetDelta() int64

func (*MetricReq) GetHash

func (x *MetricReq) GetHash() string

func (*MetricReq) GetId

func (x *MetricReq) GetId() string

func (*MetricReq) GetMtype

func (x *MetricReq) GetMtype() string

func (*MetricReq) GetValue

func (x *MetricReq) GetValue() float64

func (*MetricReq) ProtoMessage

func (*MetricReq) ProtoMessage()

func (*MetricReq) ProtoReflect

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

func (*MetricReq) Reset

func (x *MetricReq) Reset()

func (*MetricReq) String

func (x *MetricReq) String() string

type MetricsClient

type MetricsClient interface {
	Update(ctx context.Context, in *MetricReq, opts ...grpc.CallOption) (*MetricReq, error)
	BatchUpdate(ctx context.Context, in *BatchUpdateRequest, opts ...grpc.CallOption) (*BatchUpdateResponse, error)
	Get(ctx context.Context, in *GetMetricRequest, opts ...grpc.CallOption) (*MetricReq, error)
}

MetricsClient is the client API for Metrics 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 NewMetricsClient

func NewMetricsClient(cc grpc.ClientConnInterface) MetricsClient

type MetricsServer

type MetricsServer interface {
	Update(context.Context, *MetricReq) (*MetricReq, error)
	BatchUpdate(context.Context, *BatchUpdateRequest) (*BatchUpdateResponse, error)
	Get(context.Context, *GetMetricRequest) (*MetricReq, error)
	// contains filtered or unexported methods
}

MetricsServer is the server API for Metrics service. All implementations must embed UnimplementedMetricsServer for forward compatibility

type UnimplementedHealthServer

type UnimplementedHealthServer struct {
}

UnimplementedHealthServer must be embedded to have forward compatible implementations.

func (UnimplementedHealthServer) Ping

type UnimplementedMetricsServer

type UnimplementedMetricsServer struct {
}

UnimplementedMetricsServer must be embedded to have forward compatible implementations.

func (UnimplementedMetricsServer) BatchUpdate

func (UnimplementedMetricsServer) Get

func (UnimplementedMetricsServer) Update

type UnsafeHealthServer

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

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

type UnsafeMetricsServer

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

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

Jump to

Keyboard shortcuts

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