mempool

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocator

type Allocator[T any] interface {
	New() T
	Reset(T)
}

type CollectionPool

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

func NewCollectionPool

func NewCollectionPool[T any](alloc Allocator[T]) *CollectionPool[T]

func (*CollectionPool[T]) Get

func (p *CollectionPool[T]) Get() T

nolint: gocritic // commentedOutCode

func (CollectionPool[T]) GetSlice

func (p CollectionPool[T]) GetSlice() *[]T

func (*CollectionPool[T]) Put

func (p *CollectionPool[T]) Put(t T)

func (*CollectionPool[T]) PutSlice

func (p *CollectionPool[T]) PutSlice(s *[]T)

type Pool

type Pool[T any] struct {
	sync.Pool
}

func NewPool

func NewPool[T any](newF func() T) *Pool[T]

func NewSlicePool

func NewSlicePool[T any](capacity int) *Pool[*[]T]

func (*Pool[T]) Get

func (p *Pool[T]) Get() T

func (*Pool[T]) Put

func (p *Pool[T]) Put(x T)

type RelationAllocator

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

func NewRelationAllocator

func NewRelationAllocator() *RelationAllocator

func (*RelationAllocator) New

func (*RelationAllocator) Reset

func (ra *RelationAllocator) Reset(rel *dsc.RelationIdentifier)

type RelationsPool

type RelationsPool = CollectionPool[*dsc.RelationIdentifier]

func NewRelationsPool

func NewRelationsPool() *RelationsPool

Jump to

Keyboard shortcuts

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