container

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPipeEOF      = io.EOF
	ErrPipeCanceled = fmt.Errorf("pipe canceled")
)

Functions

This section is empty.

Types

type Object

type Object interface {
	Close(exception error) error
}

type ObjectPool

type ObjectPool struct {
	L sync.Mutex // STW
	// contains filtered or unexported fields
}

func NewObjectPool

func NewObjectPool(idleTimeout time.Duration) *ObjectPool

func (*ObjectPool) Close

func (s *ObjectPool) Close()

func (*ObjectPool) Pop

func (s *ObjectPool) Pop(key string) Object

func (*ObjectPool) Push

func (s *ObjectPool) Push(key string, o Object)

type Pipe

type Pipe[Item any] struct {
	// contains filtered or unexported fields
}

Pipe implement a queue that never block on Write but block on Read if there is nothing to read

func NewPipe

func NewPipe[Item any]() *Pipe[Item]

func (*Pipe[Item]) Cancel

func (p *Pipe[Item]) Cancel()

func (*Pipe[Item]) Close

func (p *Pipe[Item]) Close()

func (*Pipe[Item]) Read

func (p *Pipe[Item]) Read(ctx context.Context, items []Item) (n int, err error)

Read will block if there is nothing to read

func (*Pipe[Item]) Write

func (p *Pipe[Item]) Write(ctx context.Context, items ...Item) (err error)

type Queue

type Queue[ValueType any] struct {
	// contains filtered or unexported fields
}

Queue implement a concurrent-safe queue

func NewQueue

func NewQueue[ValueType any]() *Queue[ValueType]

func (*Queue[ValueType]) Add

func (q *Queue[ValueType]) Add(val ValueType)

func (*Queue[ValueType]) Get

func (q *Queue[ValueType]) Get() (val ValueType, ok bool)

func (*Queue[ValueType]) Size

func (q *Queue[ValueType]) Size() int

type Stack

type Stack[ValueType any] struct {
	L sync.Mutex
	// contains filtered or unexported fields
}

func NewStack

func NewStack[ValueType any]() *Stack[ValueType]

func (*Stack[ValueType]) Pop

func (s *Stack[ValueType]) Pop() (value ValueType, ok bool)

func (*Stack[ValueType]) PopBottom

func (s *Stack[ValueType]) PopBottom() (value ValueType, ok bool)

func (*Stack[ValueType]) Push

func (s *Stack[ValueType]) Push(value ValueType)

func (*Stack[ValueType]) RangeDelete

func (s *Stack[ValueType]) RangeDelete(checking func(v ValueType) (deleteNode, continueRange bool))

RangeDelete range from the stack bottom

func (*Stack[ValueType]) Size

func (s *Stack[ValueType]) Size() (size int)

Jump to

Keyboard shortcuts

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