queuerpc

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_queue_proto protoreflect.FileDescriptor
View Source
var Queued_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "queuerpc.Queued",
	HandlerType: (*QueuedServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Delete",
			Handler:    _Queued_Delete_Handler,
		},
		{
			MethodName: "Len",
			Handler:    _Queued_Len_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _Queued_Get_Handler,
		},
		{
			MethodName: "Put",
			Handler:    _Queued_Put_Handler,
		},
		{
			MethodName: "Refresh",
			Handler:    _Queued_Refresh_Handler,
		},
		{
			MethodName: "Acknowledge",
			Handler:    _Queued_Acknowledge_Handler,
		},
		{
			MethodName: "Requeue",
			Handler:    _Queued_Requeue_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "queue.proto",
}

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

Functions

func RegisterQueuedServer

func RegisterQueuedServer(s grpc.ServiceRegistrar, srv QueuedServer)

func ToBytes

func ToBytes(c *Content) ([]byte, error)

ToBytes converts a *Content to a slice of bytes.

func ToBytesAndString

func ToBytesAndString(cq *ContentAndQueueName) ([]byte, string, error)

ToBytesAndString converts a *ContentAndQueueName to a slice of bytes and a string.

func ToID

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

ToID converts a *ID to a driver.ID.

func ToIDBytesAndTime

func ToIDBytesAndTime(m *Message) (driver.ID, []byte, time.Time, error)

ToIDBytesAndTime converts a *Message to a driver.ID, a slice of bytes, and a time.Time.

func ToInt

func ToInt(ql *QueueLength) (int, error)

ToInt converts a *QueueLength to an int.

func ToString

func ToString(qn *QueueName) (string, error)

ToString converts a *QueueName to a string.

func ToTime

func ToTime(et *ExpiryTime) (time.Time, error)

ToTime converts a *ExpiryTime to a time.Time.

Types

type Content

type Content struct {
	Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	// contains filtered or unexported fields
}

Content represents the content of a message.

func FromBytes

func FromBytes(b []byte) *Content

FromBytes converts a slice of bytes to a *Content.

func (*Content) Descriptor deprecated

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

Deprecated: Use Content.ProtoReflect.Descriptor instead.

func (*Content) GetContent

func (x *Content) GetContent() []byte

func (*Content) ProtoMessage

func (*Content) ProtoMessage()

func (*Content) ProtoReflect

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

func (*Content) Reset

func (x *Content) Reset()

func (*Content) String

func (x *Content) String() string

type ContentAndQueueName

type ContentAndQueueName struct {
	Content *Content   `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	Name    *QueueName `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

ContentAndQueueName represents message content plus the name of a queue.

func FromBytesAndString

func FromBytesAndString(b []byte, name string) *ContentAndQueueName

FromBytesAndString converts a slice of bytes and a string to a *ContentAndQueueName.

func (*ContentAndQueueName) Descriptor deprecated

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

Deprecated: Use ContentAndQueueName.ProtoReflect.Descriptor instead.

func (*ContentAndQueueName) GetContent

func (x *ContentAndQueueName) GetContent() *Content

func (*ContentAndQueueName) GetName

func (x *ContentAndQueueName) GetName() *QueueName

func (*ContentAndQueueName) ProtoMessage

func (*ContentAndQueueName) ProtoMessage()

func (*ContentAndQueueName) ProtoReflect

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

func (*ContentAndQueueName) Reset

func (x *ContentAndQueueName) Reset()

func (*ContentAndQueueName) String

func (x *ContentAndQueueName) String() string

type ExpiryTime

type ExpiryTime struct {
	Time *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
	// contains filtered or unexported fields
}

ExpiryTime represents the time by which a message much be acknowledged, requeued, or refreshed.

func FromTime

func FromTime(t time.Time) *ExpiryTime

FromTime converts a time.Time to a *ExpiryTime.

func (*ExpiryTime) Descriptor deprecated

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

Deprecated: Use ExpiryTime.ProtoReflect.Descriptor instead.

func (*ExpiryTime) GetTime

func (x *ExpiryTime) GetTime() *timestamppb.Timestamp

func (*ExpiryTime) ProtoMessage

func (*ExpiryTime) ProtoMessage()

func (*ExpiryTime) ProtoReflect

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

func (*ExpiryTime) Reset

func (x *ExpiryTime) Reset()

func (*ExpiryTime) String

func (x *ExpiryTime) String() string

type ID

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

ID represents a unique ID for a message.

func FromID

func FromID(id driver.ID) *ID

FromID converts a driver.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

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

func (*ID) Reset

func (x *ID) Reset()

func (*ID) String

func (x *ID) String() string

type Message

type Message struct {
	Content *Content    `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // The message content
	Id      *ID         `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`           // The message ID
	Expiry  *ExpiryTime `protobuf:"bytes,3,opt,name=expiry,proto3" json:"expiry,omitempty"`   // The expiry time
	// contains filtered or unexported fields
}

Message represents a message.

func FromIDBytesAndTime

func FromIDBytesAndTime(id driver.ID, b []byte, t time.Time) *Message

FromIDBytesAndTime converts an ID, a slice of bytes, and an expiry time to a *Message.

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetContent

func (x *Message) GetContent() *Content

func (*Message) GetExpiry

func (x *Message) GetExpiry() *ExpiryTime

func (*Message) GetId

func (x *Message) GetId() *ID

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type QueueLength

type QueueLength struct {
	Len int64 `protobuf:"varint,1,opt,name=len,proto3" json:"len,omitempty"`
	// contains filtered or unexported fields
}

QueueLength represents the length of a queue.

func FromInt

func FromInt(n int) *QueueLength

FromInt converts an int to a *QueueLength.

func (*QueueLength) Descriptor deprecated

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

Deprecated: Use QueueLength.ProtoReflect.Descriptor instead.

func (*QueueLength) GetLen

func (x *QueueLength) GetLen() int64

func (*QueueLength) ProtoMessage

func (*QueueLength) ProtoMessage()

func (*QueueLength) ProtoReflect

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

func (*QueueLength) Reset

func (x *QueueLength) Reset()

func (*QueueLength) String

func (x *QueueLength) String() string

type QueueName

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

QueueName represents the name of a queue.

func FromString

func FromString(name string) *QueueName

FromString converts a string to a *QueueName.

func (*QueueName) Descriptor deprecated

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

Deprecated: Use QueueName.ProtoReflect.Descriptor instead.

func (*QueueName) GetName

func (x *QueueName) GetName() string

func (*QueueName) ProtoMessage

func (*QueueName) ProtoMessage()

func (*QueueName) ProtoReflect

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

func (*QueueName) Reset

func (x *QueueName) Reset()

func (*QueueName) String

func (x *QueueName) String() string

type QueuedClient

type QueuedClient interface {
	// Delete deletes the queue with the given name.
	Delete(ctx context.Context, in *QueueName, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Len returns the number of messages in the queue with the given name that are not awaiting acknowledgement.
	Len(ctx context.Context, in *QueueName, opts ...grpc.CallOption) (*QueueLength, error)
	// Get returns the next message from the queue with the given name. The message will, eventually, be automatically requeued if it is not acknowledged.
	Get(ctx context.Context, in *QueueName, opts ...grpc.CallOption) (*Message, error)
	// Put places a message with the given content on the queue with the given name.
	Put(ctx context.Context, in *ContentAndQueueName, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Refresh gets a new expiry time for the message with the given ID.
	Refresh(ctx context.Context, in *ID, opts ...grpc.CallOption) (*ExpiryTime, error)
	// Acknowledge removes the message with the given ID from its queue.
	Acknowledge(ctx context.Context, in *ID, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Requeue requeues the message with the given ID.
	Requeue(ctx context.Context, in *ID, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

QueuedClient is the client API for Queued 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 NewQueuedClient

func NewQueuedClient(cc grpc.ClientConnInterface) QueuedClient

type QueuedServer

type QueuedServer interface {
	// Delete deletes the queue with the given name.
	Delete(context.Context, *QueueName) (*emptypb.Empty, error)
	// Len returns the number of messages in the queue with the given name that are not awaiting acknowledgement.
	Len(context.Context, *QueueName) (*QueueLength, error)
	// Get returns the next message from the queue with the given name. The message will, eventually, be automatically requeued if it is not acknowledged.
	Get(context.Context, *QueueName) (*Message, error)
	// Put places a message with the given content on the queue with the given name.
	Put(context.Context, *ContentAndQueueName) (*emptypb.Empty, error)
	// Refresh gets a new expiry time for the message with the given ID.
	Refresh(context.Context, *ID) (*ExpiryTime, error)
	// Acknowledge removes the message with the given ID from its queue.
	Acknowledge(context.Context, *ID) (*emptypb.Empty, error)
	// Requeue requeues the message with the given ID.
	Requeue(context.Context, *ID) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

QueuedServer is the server API for Queued service. All implementations must embed UnimplementedQueuedServer for forward compatibility

type UnimplementedQueuedServer

type UnimplementedQueuedServer struct {
}

UnimplementedQueuedServer must be embedded to have forward compatible implementations.

func (UnimplementedQueuedServer) Acknowledge

func (UnimplementedQueuedServer) Delete

func (UnimplementedQueuedServer) Get

func (UnimplementedQueuedServer) Len

func (UnimplementedQueuedServer) Put

func (UnimplementedQueuedServer) Refresh

func (UnimplementedQueuedServer) Requeue

type UnsafeQueuedServer

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

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

Jump to

Keyboard shortcuts

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