container

package
v0.0.0-...-0662ccb Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2019 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalQueue

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

func NewLocalQueue

func NewLocalQueue(goNum int, queueSize int, stopCh <-chan struct{}) *LocalQueue

func (*LocalQueue) Add

func (localQueue *LocalQueue) Add(task *Task)

type SyncQueue

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

Synchronous FIFO queue

func NewSyncQueue

func NewSyncQueue() *SyncQueue

Create a new SyncQueue

func (*SyncQueue) Close

func (q *SyncQueue) Close()

Close SyncQueue

After close, Pop will return nil without block, and TryPop will return v=nil, ok=True

func (*SyncQueue) Len

func (q *SyncQueue) Len() (l int)

Get the length of SyncQueue

func (*SyncQueue) Pop

func (q *SyncQueue) Pop() (v interface{})

Pop an item from SyncQueue, will block if SyncQueue is empty

func (*SyncQueue) Push

func (q *SyncQueue) Push(v interface{})

Push an item to SyncQueue. Always returns immediately without blocking

func (*SyncQueue) TryPop

func (q *SyncQueue) TryPop() (v interface{}, ok bool)

Try to pop an item from SyncQueue, will return immediately with bool=false if SyncQueue is empty

type Task

type Task struct {
	Context    interface{}
	HandleFunc TaskHandleFunc
}

func NewTask

func NewTask(context interface{}, handleFunc TaskHandleFunc) *Task

type TaskHandleFunc

type TaskHandleFunc func(context interface{})

Jump to

Keyboard shortcuts

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