_2_block_queue

package
v0.0.0-...-a7c7adb Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingQueue

type BlockingQueue[T any] struct {
	// contains filtered or unexported fields
}

func NewBlockingQueue

func NewBlockingQueue[T any](ctx context.Context, queueSize int) *BlockingQueue[T]

func (*BlockingQueue[T]) Poll

func (q *BlockingQueue[T]) Poll() T

func (*BlockingQueue[T]) Push

func (q *BlockingQueue[T]) Push(value T)

func (*BlockingQueue[T]) SetRejectHandler

func (q *BlockingQueue[T]) SetRejectHandler(handler RejectHandler)

SetRejectHandler Set a reject handler.

func (*BlockingQueue[T]) TryPoll

func (q *BlockingQueue[T]) TryPoll(timeout time.Duration) (ret T, ok bool)

func (*BlockingQueue[T]) TryPush

func (q *BlockingQueue[T]) TryPush(value T, timeout time.Duration) bool

type Queue

type Queue[T any] interface {
	Push(value T)
	TryPush(value T, timeout time.Duration) bool
	Poll() T
	TryPoll(timeout time.Duration) (T, bool)
}

type RejectHandler

type RejectHandler func(ctx context.Context) bool

RejectHandler Reject push into queue if return false.

Jump to

Keyboard shortcuts

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