spq

package module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 License: CC0-1.0 Imports: 11 Imported by: 1

README

What

Persistent queue library with requirements:

  • job API: Push, Peek, Delete
  • data safety: critical
  • zero maintenance, auto-recover as much as possible and keep working
  • speed: sane, avoid obvious mistakes
  • single process access, thread safe

Credits

This library would be poorly reinvented wheel without following great work:

Flair

Build status Coverage Go Report Card

Documentation

Overview

Persistent queue library designed for single process thread-safe job queue where data loss is not an option at cost of speed.

Index

Constants

View Source
const OnlyForTesting = "\x00"

Variables

View Source
var (
	ErrClosed     = fmt.Errorf("pq is closed")
	ErrInvalidKey = fmt.Errorf("pq storage key invalid")
)

Functions

func IsCorrupted

func IsCorrupted(err error) bool

Types

type Box

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

func (*Box) Bytes

func (b *Box) Bytes() []byte

func (*Box) Unmarshal

func (b *Box) Unmarshal(x encoding.BinaryUnmarshaler) error

type Queue

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

func Open

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

func (*Queue) Close

func (q *Queue) Close() error

func (*Queue) Delete

func (q *Queue) Delete(box Box) error

func (*Queue) DeletePush added in v0.10.0

func (q *Queue) DeletePush(box Box) error

Atomic Delete+Push

func (*Queue) MarshalPush

func (q *Queue) MarshalPush(item encoding.BinaryMarshaler) error

func (*Queue) Peek

func (q *Queue) Peek() (Box, error)

func (*Queue) Push

func (q *Queue) Push(value []byte) error

Jump to

Keyboard shortcuts

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