levelqueue

package module
v0.0.0-...-02b525a Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2019 License: MIT Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

levelqueue

Level queue is a simple queue golang library base on go-leveldb.

CircleCI codecov

Installation

go get github.com/lunny/levelqueue

Usage

queue, err := levelqueue.Open("./queue")

err = queue.RPush([]byte("test"))

data, err = queue.LPop()

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound means no element in queue
	ErrNotFound = errors.New("no key found")
)

Functions

This section is empty.

Types

type Queue

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

Queue defines a queue struct

func Open

func Open(dataDir string) (*Queue, error)

Open opens a queue object or create it if not exist

func (*Queue) Close

func (queue *Queue) Close() error

Close closes the queue

func (*Queue) LPop

func (queue *Queue) LPop() ([]byte, error)

LPop pop a data from left of queue

func (*Queue) LPush

func (queue *Queue) LPush(data []byte) error

LPush pushes a data from left of queue

func (*Queue) Len

func (queue *Queue) Len() int64

Len returns the length of the queue

func (*Queue) RPop

func (queue *Queue) RPop() ([]byte, error)

RPop pop a data from right of queue

func (*Queue) RPush

func (queue *Queue) RPush(data []byte) error

RPush pushes a data from right of queue

Jump to

Keyboard shortcuts

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