src

package
v0.0.0-...-ecda0a9 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MessageIDSize = 26

MessageIDSize ...

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type KVStore

type KVStore[Key, Value any] interface {
	Init()
	Size() int64
	Get(Key) (Value, error)
	GetAll() ([]Key, []Value, error)
	GetAndDelete(Key) (Value, error)
	Store(Key, Value) error
	Delete(Key) error
}

KVStore ...

func NewKVStore

func NewKVStore[Key, Value any]() KVStore[Key, Value]

NewKVStore ...

type ListQueuesOutput

type ListQueuesOutput struct {
	Queues []string `json:"queues"`
}

func (ListQueuesOutput) EncodeJSON

func (o ListQueuesOutput) EncodeJSON() ([]byte, error)

type MQManager

type MQManager interface {
	CreateQueue(userID, name string) error
	GetQueue(userID, name string) (MessageQueue, error)
	ListQueues(userID string) ([]MessageQueue, error)
	DeleteQueue(userID, name string) error
}

MQManager ...

func NewMQManager

func NewMQManager() MQManager

NewMQManager ...

type Message

type Message struct {
	ID   string
	Data []byte
}

Message ...

func NewMessage

func NewMessage(rs RandomStringer, data []byte) (*Message, error)

NewMessage ...

func (Message) Bytes

func (m Message) Bytes() []byte

Bytes ...

type MessageQueue

type MessageQueue interface {
	Name() string
	Publish(*Message) error
	Consume() (*Message, error)
	Delete(id string) error
}

MessageQueue ...

func NewMessageQueue

func NewMessageQueue(name string) MessageQueue

NewMessageQueue ...

type MessageQueueApplication

type MessageQueueApplication struct {
	// contains filtered or unexported fields
}

MessageQueueApplication ...

func NewMessageQueueApplication

func NewMessageQueueApplication(mqm MQManager) MessageQueueApplication

NewMessageQueueApplication ...

func (MessageQueueApplication) Consume

func (a MessageQueueApplication) Consume(ctx context.Context, userID, name string) (*Message, error)

Consume ...

func (MessageQueueApplication) CreateQueue

func (a MessageQueueApplication) CreateQueue(ctx context.Context, userID, name string) error

CreateQueue ...

func (MessageQueueApplication) Delete

func (a MessageQueueApplication) Delete(ctx context.Context, userID, name, messageID string) error

Delete ...

func (MessageQueueApplication) DeleteQueue

func (a MessageQueueApplication) DeleteQueue(ctx context.Context, userID, name string) error

DeleteQueue ...

func (MessageQueueApplication) ListQueues

func (a MessageQueueApplication) ListQueues(ctx context.Context, userID string) (ListQueuesOutput, error)

ListQueues ...

func (MessageQueueApplication) Publish

func (a MessageQueueApplication) Publish(ctx context.Context, userID, name string, data []byte) error

Publish ...

type Queue

type Queue[T any] interface {
	Init()
	Size() int64
	Enqueue(T) error
	Dequeue() (T, error)
}

Queue ...

func NewQueue

func NewQueue[T any]() Queue[T]

NewQueue ...

type RandomStringer

type RandomStringer func() string

RandomStringer ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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