queue

package
v0.0.0-...-8aeb8a1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedisType    = "redis"
	InMemoryType = "inmemory"
)
View Source
const (
	DestinationNamespace = "destination"
	HTTPAdapterNamespace = "http"
)

Variables

View Source
var (
	ErrQueueClosed = errors.New("queue is closed")
)
View Source
var (
	ErrQueueEmpty = errors.New("queue is empty")
)

Functions

This section is empty.

Types

type ConcurrentLinkedQueue

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

ConcurrentLinkedQueue concurrent queue

func NewConcurrentLinkedQueue

func NewConcurrentLinkedQueue(maxSize uint32) *ConcurrentLinkedQueue

NewConcurrentLinkedQueue Creates a new queue

func (*ConcurrentLinkedQueue) Close

func (c *ConcurrentLinkedQueue) Close()

func (*ConcurrentLinkedQueue) Dequeue

func (c *ConcurrentLinkedQueue) Dequeue() (interface{}, error)

func (*ConcurrentLinkedQueue) Enqueue

func (c *ConcurrentLinkedQueue) Enqueue(data interface{}) error

func (*ConcurrentLinkedQueue) GetMaxSize

func (c *ConcurrentLinkedQueue) GetMaxSize() uint32

func (*ConcurrentLinkedQueue) GetSize

func (c *ConcurrentLinkedQueue) GetSize() uint32

type InMemory

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

func (*InMemory) BufferSize

func (im *InMemory) BufferSize() int64

func (*InMemory) Close

func (im *InMemory) Close() error

func (*InMemory) Pop

func (im *InMemory) Pop() (interface{}, error)

Pop dequeues an element (if exist) or waits until the next element gets enqueued and returns it. Multiple calls to DequeueOrWaitForNextElement() would enqueue multiple "listeners" for future enqueued elements.

func (*InMemory) Push

func (im *InMemory) Push(value interface{}) error

Push enqueues an element. Returns ErrQueueClosed if queue is closed

func (*InMemory) Size

func (im *InMemory) Size() int64

Size returns the number of enqueued elements

func (*InMemory) Type

func (im *InMemory) Type() string

type Queue

type Queue interface {
	io.Closer
	Push(interface{}) error
	Pop() (interface{}, error)
	Size() int64
	BufferSize() int64
	Type() string
}

func NewInMemory

func NewInMemory(capacity int) Queue

func NewRedis

func NewRedis(namespace, identifier string, redisPool *meta.RedisPool, serializationModelBuilder func() interface{},
	redisReadTimeout time.Duration) Queue

type Redis

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

Redis is a queue implementation based on Redis it is used blocking pop (BLPOP) command for getting elements from queue

func (*Redis) BufferSize

func (r *Redis) BufferSize() int64

func (*Redis) Close

func (r *Redis) Close() error

Close doesn't close sharedPool

func (*Redis) Pop

func (r *Redis) Pop() (interface{}, error)

func (*Redis) Push

func (r *Redis) Push(v interface{}) error

func (*Redis) Size

func (r *Redis) Size() int64

func (*Redis) Type

func (r *Redis) Type() string

Jump to

Keyboard shortcuts

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