drrqueue

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package drrqueue implements a deficit round-robin buffer queue.

Efficient Fair Queueing Using Deficit Round-Robin
M. Shreedhar and George Varghese
IEEE/ACM Transactions on Networking, Vol. 4, No. 3, June 1996

The queue supports N-writers and 1-reader queue. By "buffer," we mean []byte blocks.

Writers have a priority that takes precedence over the deficit. Writers with greater priority are served first. Deficits are not even updated for lower priorities when higher priority Writers are being served.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(quantum int) bqueue.T

New returns a new T. Each writer is allowed to send quantum bytes per round-robin cycle.

Types

type T

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

T defines the type of round-robin buffer queues. The queue has multiple input Writer queues that are served according to the deficit round-robin policy.

func (*T) Close

func (q *T) Close()

Close closes the queue.

func (*T) Find

func (q *T) Find(id bqueue.ID) bqueue.Writer

Find returns the queue with the specified ID.

func (*T) Get

func (q *T) Get(flush bqueue.FlushFunc) (bqueue.Writer, []*iobuf.Slice, error)

Get returns the next element from a queue. Get blocks until a buffer is available or the queue is closed.

func (*T) NewWriter

func (q *T) NewWriter(id bqueue.ID, p bqueue.Priority, bytes int) (bqueue.Writer, error)

NewWriter allocates a new Writer.

func (*T) String

func (q *T) String() string

String provides a string representation of the queue.

Jump to

Keyboard shortcuts

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