proto

package
v0.0.0-...-bb1c9d9 Latest Latest
Warning

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

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

Documentation

Overview

Package proto exports proto definitions required by the quota library.

Index

Constants

This section is empty.

Variables

View Source
var File_go_chromium_org_luci_server_quotabeta_proto_config_proto protoreflect.FileDescriptor
View Source
var File_go_chromium_org_luci_server_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 RegisterQuotaAdminServer

func RegisterQuotaAdminServer(s prpc.Registrar, srv QuotaAdminServer)

Types

type Config

type Config struct {
	Policy []*Policy `protobuf:"bytes,1,rep,name=policy,proto3" json:"policy,omitempty"`
	// contains filtered or unexported fields
}

A Config encapsulates a set of quota policies.

func (*Config) Descriptor deprecated

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetPolicy

func (x *Config) GetPolicy() []*Policy

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

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

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type DecoratedQuotaAdmin

type DecoratedQuotaAdmin struct {
	// Service is the service to decorate.
	Service QuotaAdminServer
	// 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 (*DecoratedQuotaAdmin) Get

func (s *DecoratedQuotaAdmin) Get(ctx context.Context, req *GetRequest) (rsp *QuotaEntry, err error)

func (*DecoratedQuotaAdmin) Set

func (s *DecoratedQuotaAdmin) Set(ctx context.Context, req *SetRequest) (rsp *QuotaEntry, err error)

type GetRequest

type GetRequest struct {

	// The named policy. Valid names depend on the policies enumerated in this
	// service's config.proto.
	//
	// Required.
	Policy string `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"`
	// The user to fetch the named quota policy for. Must be specified when the
	// policy contains the substring "${user}".
	User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

A GetRequest is a request to fetch the quota entry for a specfic policy.

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetPolicy

func (x *GetRequest) GetPolicy() string

func (*GetRequest) GetUser

func (x *GetRequest) GetUser() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type Policy

type Policy struct {

	// A globally unique name.
	//
	// Must start with a letter. Allowed characters (no spaces): A-Z a-z 0-9 - _ /
	// The substring "${user}" can be used in this name to define identical
	// per-user policies. Must not exceed 64 characters.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The amount of resources available. Must not be negative.
	Resources int64 `protobuf:"varint,2,opt,name=resources,proto3" json:"resources,omitempty"`
	// The amount of resources to replenish every second. Must not be negative.
	Replenishment int64 `protobuf:"varint,3,opt,name=replenishment,proto3" json:"replenishment,omitempty"`
	// contains filtered or unexported fields
}

A Policy represents an abstract quota policy.

Policies should be defined in ways that are relevant to each service. For example, a policy may represent "builds for builder B", in which case resources may be interpreted as "number of builds", or a policy may represent "storage in database D", in which case resources may be interpreted as "stored bytes".

func (*Policy) Descriptor deprecated

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

Deprecated: Use Policy.ProtoReflect.Descriptor instead.

func (*Policy) GetName

func (x *Policy) GetName() string

func (*Policy) GetReplenishment

func (x *Policy) GetReplenishment() int64

func (*Policy) GetResources

func (x *Policy) GetResources() int64

func (*Policy) ProtoMessage

func (*Policy) ProtoMessage()

func (*Policy) ProtoReflect

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

func (*Policy) Reset

func (x *Policy) Reset()

func (*Policy) String

func (x *Policy) String() string

type QuotaAdminClient

type QuotaAdminClient interface {
	// Get returns the available resources for the given policy.
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*QuotaEntry, error)
	// Set updates the available resources for the given policy.
	Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*QuotaEntry, error)
}

QuotaAdminClient is the client API for QuotaAdmin service.

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

func NewQuotaAdminClient

func NewQuotaAdminClient(cc grpc.ClientConnInterface) QuotaAdminClient

func NewQuotaAdminPRPCClient

func NewQuotaAdminPRPCClient(client *prpc.Client) QuotaAdminClient

type QuotaAdminServer

type QuotaAdminServer interface {
	// Get returns the available resources for the given policy.
	Get(context.Context, *GetRequest) (*QuotaEntry, error)
	// Set updates the available resources for the given policy.
	Set(context.Context, *SetRequest) (*QuotaEntry, error)
}

QuotaAdminServer is the server API for QuotaAdmin service.

type QuotaEntry

type QuotaEntry struct {

	// The name of this quota entry.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The raw name of this entry in the redis database.
	DbName string `protobuf:"bytes,2,opt,name=db_name,json=dbName,proto3" json:"db_name,omitempty"`
	// The amount of resources available.
	Resources int64 `protobuf:"varint,3,opt,name=resources,proto3" json:"resources,omitempty"`
	// contains filtered or unexported fields
}

A QuotaEntry represents a database entry for the named quota entry.

func (*QuotaEntry) Descriptor deprecated

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

Deprecated: Use QuotaEntry.ProtoReflect.Descriptor instead.

func (*QuotaEntry) GetDbName

func (x *QuotaEntry) GetDbName() string

func (*QuotaEntry) GetName

func (x *QuotaEntry) GetName() string

func (*QuotaEntry) GetResources

func (x *QuotaEntry) GetResources() int64

func (*QuotaEntry) ProtoMessage

func (*QuotaEntry) ProtoMessage()

func (*QuotaEntry) ProtoReflect

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

func (*QuotaEntry) Reset

func (x *QuotaEntry) Reset()

func (*QuotaEntry) String

func (x *QuotaEntry) String() string

type SetRequest

type SetRequest struct {

	// The named policy. Valid names depend on the policies enumerated in this
	// service's config.proto.
	//
	// Required.
	Policy string `protobuf:"bytes,1,opt,name=policy,proto3" json:"policy,omitempty"`
	// The user to fetch the named quota policy for. Must be specified when the
	// policy contains the substring "${user}".
	User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	// The amount of resources that should be available. Must be non-negative.
	// Values exceeding the max specified in the policy config will be capped.
	Resources int64 `protobuf:"varint,3,opt,name=resources,proto3" json:"resources,omitempty"`
	// contains filtered or unexported fields
}

A SetRequest is a request to set available resources for a specific policy.

func (*SetRequest) Descriptor deprecated

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

Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.

func (*SetRequest) GetPolicy

func (x *SetRequest) GetPolicy() string

func (*SetRequest) GetResources

func (x *SetRequest) GetResources() int64

func (*SetRequest) GetUser

func (x *SetRequest) GetUser() string

func (*SetRequest) ProtoMessage

func (*SetRequest) ProtoMessage()

func (*SetRequest) ProtoReflect

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

func (*SetRequest) Reset

func (x *SetRequest) Reset()

func (*SetRequest) String

func (x *SetRequest) String() string

type UnimplementedQuotaAdminServer

type UnimplementedQuotaAdminServer struct {
}

UnimplementedQuotaAdminServer can be embedded to have forward compatible implementations.

func (*UnimplementedQuotaAdminServer) Get

func (*UnimplementedQuotaAdminServer) Set

Jump to

Keyboard shortcuts

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