Documentation ¶
Overview ¶
Package boltqueue provides a persistent queue or priority queue based on boltdb (https://github.com/McSwitch/bolt)
Priority Queue ¶
boltqueue's PQueue type represents a priority queue. Messages may be inserted into the queue at a numeric priority between 0(highest) and 255(lowest). Messages are dequeued following priority order, then time ordering, with the oldest messages of the highest priority emerging first.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a message in the priority queue
func NewMessage ¶
NewMessage generates a new priority queue message
type Options ¶
type Options struct { // Timeout is the amount of time to wait to obtain a file lock. // When set to zero it will wait indefinitely. This option is only // available on Darwin and Linux. Timeout time.Duration // Sets the DB.NoGrowSync flag before memory mapping the file. NoGrowSync bool // Open database in read-only mode. Uses flock(..., LOCK_SH |LOCK_NB) to // grab a shared lock (UNIX). ReadOnly bool // Sets the DB.MmapFlags flag before memory mapping the file. MmapFlags int // InitialMmapSize is the initial mmap size of the database // in bytes. Read transactions won't block write transaction // if the InitialMmapSize is large enough to hold database mmap // size. (See DB.Begin for more information) // // If <=0, the initial map size is 0. // If initialMmapSize is smaller than the previous database size, // it takes no effect. InitialMmapSize int }
Options represents the options that can be set when opening a database.
type PQueue ¶
type PQueue struct {
// contains filtered or unexported fields
}
PQueue is a priority queue backed by a Bolt database on disk
func (*PQueue) Dequeue ¶
Dequeue removes the oldest, highest priority message from the queue and returns it