queue

package
v0.0.0-...-833c838 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package queue provides TimeBoundedQueue

the queue items are dequeued non-deterministically, but time bounds are set

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicTBQueue

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

implements TimeBoundedQueue

func (*BasicTBQueue) Enqueue

func (this *BasicTBQueue) Enqueue(item_ TimeBoundedQueueItem) error

func (*BasicTBQueue) GetDequeueChan

func (this *BasicTBQueue) GetDequeueChan() chan TimeBoundedQueueItem

type BasicTBQueueItem

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

implements TimeBoundedQueueItem

func NewBasicTBQueueItem

func NewBasicTBQueueItem(value interface{}, minDuration, maxDuration time.Duration) (*BasicTBQueueItem, error)

func (*BasicTBQueueItem) EnqueuedTime

func (this *BasicTBQueueItem) EnqueuedTime() time.Time

func (*BasicTBQueueItem) MaxDuration

func (this *BasicTBQueueItem) MaxDuration() time.Duration

func (*BasicTBQueueItem) MinDuration

func (this *BasicTBQueueItem) MinDuration() time.Duration

func (*BasicTBQueueItem) Value

func (this *BasicTBQueueItem) Value() interface{}

type TimeBoundedQueue

type TimeBoundedQueue interface {
	// enqueue
	Enqueue(TimeBoundedQueueItem) error

	// get channel for dequeue
	GetDequeueChan() chan TimeBoundedQueueItem
}

concurrent-safe, time-bounded queue.

designed for ExplorePolicies.

func NewBasicTBQueue

func NewBasicTBQueue() TimeBoundedQueue

type TimeBoundedQueueItem

type TimeBoundedQueueItem interface {
	// item value
	Value() interface{}

	// enqueued time
	EnqueuedTime() time.Time

	// min duration
	MinDuration() time.Duration

	// max duration (>= MinDuration)
	MaxDuration() time.Duration
}

item for TimeBoundedQueue

Jump to

Keyboard shortcuts

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