Documentation ¶
Index ¶
- Variables
- type Consumer
- type Item
- type Options
- type Queue
- func (q *Queue) Close()
- func (q *Queue) DeleteAll() error
- func (q *Queue) Drop()
- func (q *Queue) Enqueue(value []byte) error
- func (q *Queue) Flush() error
- func (q *Queue) GetNext() ([]byte, error)
- func (q *Queue) Head() uint64
- func (q *Queue) IsEmpty() bool
- func (q *Queue) Length() uint64
- func (q *Queue) Path() string
- func (q *Queue) Peek() ([]byte, error)
- func (q *Queue) PutBack(value []byte) error
- func (q *Queue) ReadItemByID(id uint64) (*Item, error)
- func (q *Queue) ReadItemByOffset(offset uint64) (*Item, error)
- func (q *Queue) Stats() *Stats
- func (q *Queue) Tail() uint64
- type Stats
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrIsEmpty is returned when queue is empty ErrIsEmpty = errors.New("queue: is empty") // ErrIDOutOfBounds is returned when queue is is out of bounds ErrIDOutOfBounds = errors.New("queue: ID is out of bounds") // ErrInvalidName is returned when queue name is not valid ErrInvalidName = errors.New("queue: name is not alphanumeric") // ErrNameTooLong means that queue name is longer then allowed limit ErrNameTooLong = errors.New("queue: name is too long") // ErrInvalidHeadValue is returned when there is an attempt // to assign invalid queue head value ErrInvalidHeadValue = errors.New("queue: head can not be less then zero") ErrSharedFlush = errors.New("queue: can't flush shared queue") )
Functions ¶
This section is empty.
Types ¶
type Consumer ¶ added in v0.5.1
type Consumer interface { GetNext() ([]byte, error) PutBack([]byte) error Peek() ([]byte, error) Flush() error Length() uint64 IsEmpty() bool Stats() *Stats }
Consumer represents a queue consumer
type Options ¶ added in v0.5.1
type Options struct {
KeyPrefix []byte
}
Options represents queue options
type Queue ¶
type Queue struct { sync.RWMutex Name string DataDir string // contains filtered or unexported fields }
Queue represents a persistent FIFO structure that stores the data in leveldb
func OpenShared ¶ added in v0.5.1
OpenShared creates and initializes a queue from opened leveldb database
func (*Queue) DeleteAll ¶ added in v0.5.1
DeleteAll deletes all items from the queue. This is expensive operation. If you want to drop all elements, it's better to close the queue and leveldb folder
func (*Queue) ReadItemByID ¶ added in v0.5.1
ReadItemByID returns a value by it's id
func (*Queue) ReadItemByOffset ¶ added in v0.5.1
ReadItemByOffset returns an item by offset from the queue head, starting from 0.
Click to show internal directories.
Click to hide internal directories.