limits

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 17 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInternal = errors.New("internal failure")
View Source
var ErrReached = errors.New("usage limit reached")
View Source
var ErrUnavailable = errors.New("unavailable")
View Source
var File_api_grpc_limits_service_proto protoreflect.FileDescriptor

Functions

func RegisterServiceServer added in v0.0.2

func RegisterServiceServer(s *grpc.Server, srv ServiceServer)

Types

type GetRequest added in v0.0.2

type GetRequest struct {
	Subj subject.Subject `protobuf:"varint,1,opt,name=subj,proto3,enum=awakari.api.subject.Subject" json:"subj,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated added in v0.0.2

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetSubj added in v0.0.2

func (x *GetRequest) GetSubj() subject.Subject

func (*GetRequest) ProtoMessage added in v0.0.2

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect added in v0.0.2

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

func (*GetRequest) Reset added in v0.0.2

func (x *GetRequest) Reset()

func (*GetRequest) String added in v0.0.2

func (x *GetRequest) String() string

type GetResponse added in v0.0.2

type GetResponse struct {
	UserId  string                 `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`
	Count   int64                  `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
	Expires *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires,proto3" json:"expires,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResponse) Descriptor deprecated added in v0.0.2

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetCount added in v0.0.2

func (x *GetResponse) GetCount() int64

func (*GetResponse) GetExpires added in v1.0.5

func (x *GetResponse) GetExpires() *timestamppb.Timestamp

func (*GetResponse) GetUserId added in v0.0.2

func (x *GetResponse) GetUserId() string

func (*GetResponse) ProtoMessage added in v0.0.2

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect added in v0.0.2

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

func (*GetResponse) Reset added in v0.0.2

func (x *GetResponse) Reset()

func (*GetResponse) String added in v0.0.2

func (x *GetResponse) String() string

type Service

type Service interface {
	Get(ctx context.Context, userId string, subj usage.Subject) (l usage.Limit, err error)
}

func NewService

func NewService(client ServiceClient) Service

func NewServiceMock

func NewServiceMock() Service

type ServiceClient added in v0.0.2

type ServiceClient interface {
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
}

ServiceClient is the client API for Service service.

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

func NewClientConnPool added in v1.2.0

func NewClientConnPool(connPool *grpcpool.Pool) ServiceClient

func NewServiceClient added in v0.0.2

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer added in v0.0.2

type ServiceServer interface {
	Get(context.Context, *GetRequest) (*GetResponse, error)
}

ServiceServer is the server API for Service service.

type UnimplementedServiceServer added in v0.0.2

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedServiceServer) Get added in v0.0.2

Jump to

Keyboard shortcuts

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