proto

package
v0.0.0-...-2cc3bea Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package proto contains a dummy pRPC service used by the quota library sample app. Implemented in examples/appengine/quota/rpc.

Index

Constants

This section is empty.

Variables

View Source
var File_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto protoreflect.FileDescriptor

Functions

func FileDescriptorSet

func FileDescriptorSet() *descriptorpb.FileDescriptorSet

FileDescriptorSet returns a descriptor set for this proto package, which includes all defined services, and all transitive dependencies.

Will not return nil.

Do NOT modify the returned descriptor.

func RegisterDemoServer

func RegisterDemoServer(s prpc.Registrar, srv DemoServer)

Types

type DecoratedDemo

type DecoratedDemo struct {
	// Service is the service to decorate.
	Service DemoServer
	// Prelude is called for each method before forwarding the call to Service.
	// If Prelude returns an error, then the call is skipped and the error is
	// processed via the Postlude (if one is defined), or it is returned directly.
	Prelude func(ctx context.Context, methodName string, req proto.Message) (context.Context, error)
	// Postlude is called for each method after Service has processed the call, or
	// after the Prelude has returned an error. This takes the Service's
	// response proto (which may be nil) and/or any error. The decorated
	// service will return the response (possibly mutated) and error that Postlude
	// returns.
	Postlude func(ctx context.Context, methodName string, rsp proto.Message, err error) error
}

func (*DecoratedDemo) GlobalQuotaReset

func (s *DecoratedDemo) GlobalQuotaReset(ctx context.Context, req *emptypb.Empty) (rsp *emptypb.Empty, err error)

func (*DecoratedDemo) GlobalRateLimit

func (s *DecoratedDemo) GlobalRateLimit(ctx context.Context, req *emptypb.Empty) (rsp *emptypb.Empty, err error)

func (*DecoratedDemo) PerUserQuotaReset

func (s *DecoratedDemo) PerUserQuotaReset(ctx context.Context, req *emptypb.Empty) (rsp *emptypb.Empty, err error)

func (*DecoratedDemo) PerUserRateLimit

func (s *DecoratedDemo) PerUserRateLimit(ctx context.Context, req *emptypb.Empty) (rsp *emptypb.Empty, err error)

type DemoClient

type DemoClient interface {
	// GlobalRateLimit is an endpoint globally limited to one request every 60
	// seconds. This quota can be reset at any time by calling GlobalQuotaReset.
	GlobalRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// GlobalQuotaReset resets quota for calling GlobalRateLimit.
	GlobalQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// PerUserRateLimit is an endpoint limited to two requests every 60 seconds
	// from any given user. Users can reset their own quota at any time by calling
	// PerUserQuotaReset.
	PerUserRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// PerUserQuotaReset resets the caller's quota for calling PerUserRateLimit.
	PerUserQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

DemoClient is the client API for Demo service.

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

func NewDemoClient

func NewDemoClient(cc grpc.ClientConnInterface) DemoClient

func NewDemoPRPCClient

func NewDemoPRPCClient(client *prpc.Client) DemoClient

type DemoServer

type DemoServer interface {
	// GlobalRateLimit is an endpoint globally limited to one request every 60
	// seconds. This quota can be reset at any time by calling GlobalQuotaReset.
	GlobalRateLimit(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// GlobalQuotaReset resets quota for calling GlobalRateLimit.
	GlobalQuotaReset(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// PerUserRateLimit is an endpoint limited to two requests every 60 seconds
	// from any given user. Users can reset their own quota at any time by calling
	// PerUserQuotaReset.
	PerUserRateLimit(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// PerUserQuotaReset resets the caller's quota for calling PerUserRateLimit.
	PerUserQuotaReset(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
}

DemoServer is the server API for Demo service.

type UnimplementedDemoServer

type UnimplementedDemoServer struct {
}

UnimplementedDemoServer can be embedded to have forward compatible implementations.

func (*UnimplementedDemoServer) GlobalQuotaReset

func (*UnimplementedDemoServer) GlobalRateLimit

func (*UnimplementedDemoServer) PerUserQuotaReset

func (*UnimplementedDemoServer) PerUserRateLimit

Jump to

Keyboard shortcuts

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