rangerpc

package
Version: v0.0.15 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_range_proto protoreflect.FileDescriptor
View Source
var Range_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rangerpc.Range",
	HandlerType: (*RangeServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _Range_Create_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Range_Delete_Handler,
		},
		{
			MethodName: "RequeueActive",
			Handler:    _Range_RequeueActive_Handler,
		},
		{
			MethodName: "RequeueSucceeded",
			Handler:    _Range_RequeueSucceeded_Handler,
		},
		{
			MethodName: "RequeueFailed",
			Handler:    _Range_RequeueFailed_Handler,
		},
		{
			MethodName: "Next",
			Handler:    _Range_Next_Handler,
		},
		{
			MethodName: "Success",
			Handler:    _Range_Success_Handler,
		},
		{
			MethodName: "Error",
			Handler:    _Range_Error_Handler,
		},
		{
			MethodName: "Requeue",
			Handler:    _Range_Requeue_Handler,
		},
		{
			MethodName: "Fatal",
			Handler:    _Range_Fatal_Handler,
		},
		{
			MethodName: "List",
			Handler:    _Range_List_Handler,
		},
		{
			MethodName: "Status",
			Handler:    _Range_Status_Handler,
		},
		{
			MethodName: "Info",
			Handler:    _Range_Info_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "range.proto",
}

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

Functions

func RegisterRangeServer

func RegisterRangeServer(s grpc.ServiceRegistrar, srv RangeServer)

func ToEntry

func ToEntry(e *Entry) (irange.Entry, error)

ToEntry converts the given *Entry to an irange.Entry.

func ToID

func ToID(id *ID) (irange.ID, error)

ToID converts the given *ID to an irange.ID.

func ToInfo

func ToInfo(ir *InfoResponse) (irange.Info, error)

ToInfo converts the given *InfoResponse to an irange.Info.

func ToName

func ToName(nm *Name) (string, error)

ToName converts the given *Name to a string.

func ToNameAndEntry

func ToNameAndEntry(ne *NameAndEntry) (name string, entry int64, err error)

ToNameAndEntry converts the given *NameAndEntry to a string and an int64.

func ToNames

func ToNames(lr *ListResponse) ([]string, error)

ToNames converts the given *ListResponse into a slice of strings.

func ToRangeSpecification

func ToRangeSpecification(rs *RangeSpecification) (name string, r irange.Range, lifetime time.Duration, maxRetries int, maxConcurrency int, err error)

ToRangeSpecification converts the given *RangeSpecification to a name, range r, lifetime, maximum number of retries and maximum concurrency.

func ToStatus

func ToStatus(sr *StatusResponse) (irange.Status, error)

ToStatus converts the given *StatusResponse into an irange.Status.

Types

type Entry

type Entry struct {
	Id       string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`              // the ID for this entry
	Value    int64                  `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`       // the value of this entry
	Deadline *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=deadline,proto3" json:"deadline,omitempty"`  // the time at which this entry will become stale
	Failures int64                  `protobuf:"varint,4,opt,name=failures,proto3" json:"failures,omitempty"` // the number of times this entry has failed previously
	// contains filtered or unexported fields
}

Entry describes an active entry in a range.

func FromEntry

func FromEntry(e irange.Entry) (*Entry, error)

FromEntry converts the given irange.Entry to a *Entry.

func (*Entry) Descriptor deprecated

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

Deprecated: Use Entry.ProtoReflect.Descriptor instead.

func (*Entry) GetDeadline

func (x *Entry) GetDeadline() *timestamppb.Timestamp

func (*Entry) GetFailures

func (x *Entry) GetFailures() int64

func (*Entry) GetId

func (x *Entry) GetId() string

func (*Entry) GetValue

func (x *Entry) GetValue() int64

func (*Entry) ProtoMessage

func (*Entry) ProtoMessage()

func (*Entry) ProtoReflect added in v0.0.10

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

func (*Entry) Reset

func (x *Entry) Reset()

func (*Entry) String

func (x *Entry) String() string

type ID

type ID struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // the ID for the entry
	// contains filtered or unexported fields
}

ID is an ID

func FromID

func FromID(id irange.ID) *ID

FromID converts the given id to a *ID.

func (*ID) Descriptor deprecated

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

Deprecated: Use ID.ProtoReflect.Descriptor instead.

func (*ID) GetId

func (x *ID) GetId() string

func (*ID) ProtoMessage

func (*ID) ProtoMessage()

func (*ID) ProtoReflect added in v0.0.10

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

func (*ID) Reset

func (x *ID) Reset()

func (*ID) String

func (x *ID) String() string

type InfoResponse

type InfoResponse struct {
	Value    int64                  `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`       // the value of the entry
	State    uint32                 `protobuf:"varint,2,opt,name=state,proto3" json:"state,omitempty"`       // the state of the entry
	Appname  string                 `protobuf:"bytes,3,opt,name=appname,proto3" json:"appname,omitempty"`    // the application name provided by the client to which the entry was assigned
	Hostname string                 `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`  // the hostname provided by the client to which the entry was assigned
	Start    *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=start,proto3" json:"start,omitempty"`        // the time the entry was assigned
	Deadline *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=deadline,proto3" json:"deadline,omitempty"`  // the time at which this entry will go stale
	Failures int64                  `protobuf:"varint,7,opt,name=failures,proto3" json:"failures,omitempty"` // the number of times this entry has failed
	// contains filtered or unexported fields
}

InfoResponse holds information about an entry in a range.

func FromInfo

func FromInfo(inf irange.Info) (*InfoResponse, error)

FromInfo converts the given irange.Info to a *InfoResponse.

func (*InfoResponse) Descriptor deprecated

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

Deprecated: Use InfoResponse.ProtoReflect.Descriptor instead.

func (*InfoResponse) GetAppname

func (x *InfoResponse) GetAppname() string

func (*InfoResponse) GetDeadline

func (x *InfoResponse) GetDeadline() *timestamppb.Timestamp

func (*InfoResponse) GetFailures

func (x *InfoResponse) GetFailures() int64

func (*InfoResponse) GetHostname

func (x *InfoResponse) GetHostname() string

func (*InfoResponse) GetStart

func (x *InfoResponse) GetStart() *timestamppb.Timestamp

func (*InfoResponse) GetState

func (x *InfoResponse) GetState() uint32

func (*InfoResponse) GetValue

func (x *InfoResponse) GetValue() int64

func (*InfoResponse) ProtoMessage

func (*InfoResponse) ProtoMessage()

func (*InfoResponse) ProtoReflect added in v0.0.10

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

func (*InfoResponse) Reset

func (x *InfoResponse) Reset()

func (*InfoResponse) String

func (x *InfoResponse) String() string

type ListResponse

type ListResponse struct {
	Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` // the names of the ranges
	// contains filtered or unexported fields
}

ListResponse holds a sequence of names.

func FromNames

func FromNames(names []string) *ListResponse

FromNames converts the given names into a *ListResponse.

func (*ListResponse) Descriptor deprecated

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

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetNames

func (x *ListResponse) GetNames() []string

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect added in v0.0.10

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

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

type Name

type Name struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // the name of the range
	// contains filtered or unexported fields
}

Name is the name of a range

func FromName

func FromName(s string) *Name

FromName converts the string s to a *Name.

func (*Name) Descriptor deprecated

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

Deprecated: Use Name.ProtoReflect.Descriptor instead.

func (*Name) GetName

func (x *Name) GetName() string

func (*Name) ProtoMessage

func (*Name) ProtoMessage()

func (*Name) ProtoReflect added in v0.0.10

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

func (*Name) Reset

func (x *Name) Reset()

func (*Name) String

func (x *Name) String() string

type NameAndEntry

type NameAndEntry struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`    // the name of the range
	Entry int64  `protobuf:"varint,2,opt,name=entry,proto3" json:"entry,omitempty"` // the entry in the range
	// contains filtered or unexported fields
}

NameAndEntry is the name of a range and an entry in that range.

func FromNameAndEntry

func FromNameAndEntry(name string, entry int64) *NameAndEntry

FromNameAndEntry converts the given name and entry to a *NameAndEntry

func (*NameAndEntry) Descriptor deprecated

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

Deprecated: Use NameAndEntry.ProtoReflect.Descriptor instead.

func (*NameAndEntry) GetEntry

func (x *NameAndEntry) GetEntry() int64

func (*NameAndEntry) GetName

func (x *NameAndEntry) GetName() string

func (*NameAndEntry) ProtoMessage

func (*NameAndEntry) ProtoMessage()

func (*NameAndEntry) ProtoReflect added in v0.0.10

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

func (*NameAndEntry) Reset

func (x *NameAndEntry) Reset()

func (*NameAndEntry) String

func (x *NameAndEntry) String() string

type RangeClient

type RangeClient interface {
	// Create creates a range.
	Create(ctx context.Context, in *RangeSpecification, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete deletes a range.
	Delete(ctx context.Context, in *Name, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// RequeueActive requeues all active entries in a range.
	RequeueActive(ctx context.Context, in *Name, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// RequeueSucceeded requeues all entries in a range that have succeeded.
	RequeueSucceeded(ctx context.Context, in *Name, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// RequeueFailed requeues all failed entries in a range.
	RequeueFailed(ctx context.Context, in *Name, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Next returns the next entry in a range.
	Next(ctx context.Context, in *Name, opts ...grpc.CallOption) (*Entry, error)
	// Success indicates that a given entry has succeeded.
	Success(ctx context.Context, in *ID, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Error indicates that a given entry has failed and should be retried.
	Error(ctx context.Context, in *ID, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Requeue indicates that a given entry should be retried, without incrementing the number of failures.
	Requeue(ctx context.Context, in *ID, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Fatal indicates that a given entry has failed and should not be retried.
	Fatal(ctx context.Context, in *ID, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// List returns the names of all known ranges.
	List(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListResponse, error)
	// Status returns the remaining, active, succeeded, and failed entries in a range.
	Status(ctx context.Context, in *Name, opts ...grpc.CallOption) (*StatusResponse, error)
	// Info returns information about an entry in a range.
	Info(ctx context.Context, in *NameAndEntry, opts ...grpc.CallOption) (*InfoResponse, error)
}

RangeClient is the client API for Range 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 NewRangeClient

func NewRangeClient(cc grpc.ClientConnInterface) RangeClient

type RangeServer

type RangeServer interface {
	// Create creates a range.
	Create(context.Context, *RangeSpecification) (*emptypb.Empty, error)
	// Delete deletes a range.
	Delete(context.Context, *Name) (*emptypb.Empty, error)
	// RequeueActive requeues all active entries in a range.
	RequeueActive(context.Context, *Name) (*emptypb.Empty, error)
	// RequeueSucceeded requeues all entries in a range that have succeeded.
	RequeueSucceeded(context.Context, *Name) (*emptypb.Empty, error)
	// RequeueFailed requeues all failed entries in a range.
	RequeueFailed(context.Context, *Name) (*emptypb.Empty, error)
	// Next returns the next entry in a range.
	Next(context.Context, *Name) (*Entry, error)
	// Success indicates that a given entry has succeeded.
	Success(context.Context, *ID) (*emptypb.Empty, error)
	// Error indicates that a given entry has failed and should be retried.
	Error(context.Context, *ID) (*emptypb.Empty, error)
	// Requeue indicates that a given entry should be retried, without incrementing the number of failures.
	Requeue(context.Context, *ID) (*emptypb.Empty, error)
	// Fatal indicates that a given entry has failed and should not be retried.
	Fatal(context.Context, *ID) (*emptypb.Empty, error)
	// List returns the names of all known ranges.
	List(context.Context, *emptypb.Empty) (*ListResponse, error)
	// Status returns the remaining, active, succeeded, and failed entries in a range.
	Status(context.Context, *Name) (*StatusResponse, error)
	// Info returns information about an entry in a range.
	Info(context.Context, *NameAndEntry) (*InfoResponse, error)
	// contains filtered or unexported methods
}

RangeServer is the server API for Range service. All implementations must embed UnimplementedRangeServer for forward compatibility

type RangeSpecification

type RangeSpecification struct {
	Name           string               `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`                      // the name for the range
	Range          string               `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"`                    // the range as a string, for example [[-8..-3],1,12,[25..28],30]
	Lifetime       *durationpb.Duration `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"`              // the time after which active entries become stale
	MaxRetries     int64                `protobuf:"varint,4,opt,name=maxRetries,proto3" json:"maxRetries,omitempty"`         // the maximum number of times an entry can be retried
	MaxConcurrency int64                `protobuf:"varint,5,opt,name=maxConcurrency,proto3" json:"maxConcurrency,omitempty"` // the maximum number of simultaneously active entries
	// contains filtered or unexported fields
}

RangeSpecification describes a range to be stored.

func FromRangeSpecification

func FromRangeSpecification(name string, r irange.Range, lifetime time.Duration, maxRetries int, maxConcurrency int) *RangeSpecification

FromRangeSpecification converts the the given name, range r, lifetime, maximum number of retries and maximum concurrency to a *RangeSpecification.

func (*RangeSpecification) Descriptor deprecated

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

Deprecated: Use RangeSpecification.ProtoReflect.Descriptor instead.

func (*RangeSpecification) GetLifetime

func (x *RangeSpecification) GetLifetime() *durationpb.Duration

func (*RangeSpecification) GetMaxConcurrency

func (x *RangeSpecification) GetMaxConcurrency() int64

func (*RangeSpecification) GetMaxRetries

func (x *RangeSpecification) GetMaxRetries() int64

func (*RangeSpecification) GetName

func (x *RangeSpecification) GetName() string

func (*RangeSpecification) GetRange

func (x *RangeSpecification) GetRange() string

func (*RangeSpecification) ProtoMessage

func (*RangeSpecification) ProtoMessage()

func (*RangeSpecification) ProtoReflect added in v0.0.10

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

func (*RangeSpecification) Reset

func (x *RangeSpecification) Reset()

func (*RangeSpecification) String

func (x *RangeSpecification) String() string

type StatusResponse

type StatusResponse struct {
	Pending   string `protobuf:"bytes,1,opt,name=pending,proto3" json:"pending,omitempty"`     // a string description, as above, of the pending range
	Active    string `protobuf:"bytes,2,opt,name=active,proto3" json:"active,omitempty"`       // a string description, as above, of the active range
	Succeeded string `protobuf:"bytes,3,opt,name=succeeded,proto3" json:"succeeded,omitempty"` // a string description, as above, of the succeeded range
	Failed    string `protobuf:"bytes,4,opt,name=failed,proto3" json:"failed,omitempty"`       // a string description, as above, of the failed range
	// contains filtered or unexported fields
}

StatusResponse holds four ranges

func FromStatus

func FromStatus(s irange.Status) (*StatusResponse, error)

FromStatus converts the given *irange.Status into a *StatusResponse.

func (*StatusResponse) Descriptor deprecated

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

Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.

func (*StatusResponse) GetActive

func (x *StatusResponse) GetActive() string

func (*StatusResponse) GetFailed

func (x *StatusResponse) GetFailed() string

func (*StatusResponse) GetPending

func (x *StatusResponse) GetPending() string

func (*StatusResponse) GetSucceeded

func (x *StatusResponse) GetSucceeded() string

func (*StatusResponse) ProtoMessage

func (*StatusResponse) ProtoMessage()

func (*StatusResponse) ProtoReflect added in v0.0.10

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

func (*StatusResponse) Reset

func (x *StatusResponse) Reset()

func (*StatusResponse) String

func (x *StatusResponse) String() string

type UnimplementedRangeServer

type UnimplementedRangeServer struct {
}

UnimplementedRangeServer must be embedded to have forward compatible implementations.

func (UnimplementedRangeServer) Create

func (UnimplementedRangeServer) Delete

func (UnimplementedRangeServer) Error

func (UnimplementedRangeServer) Fatal

func (UnimplementedRangeServer) Info

func (UnimplementedRangeServer) List

func (UnimplementedRangeServer) Next

func (UnimplementedRangeServer) Requeue

func (UnimplementedRangeServer) RequeueActive added in v0.0.11

func (UnimplementedRangeServer) RequeueFailed added in v0.0.11

func (UnimplementedRangeServer) RequeueSucceeded added in v0.0.11

func (UnimplementedRangeServer) Status

func (UnimplementedRangeServer) Success

type UnsafeRangeServer added in v0.0.10

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

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

Jump to

Keyboard shortcuts

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