pool

package
v0.1.51 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: LGPL-2.1 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Each added in v0.1.36

func Each(fun generic.Action2[string, *Pool])

func ManagedGet

func ManagedGet[T any](managed ManagedPooledChunk, pool *Pool) *T

func Put

func Put[T any](name string, chunk *Chunk[T])

func PutById added in v0.1.43

func PutById[T any](id uint32, chunk *Chunk[T])

func Range added in v0.1.36

func Range(fun generic.Func2[string, *Pool, bool])

Types

type Chunk added in v0.1.39

type Chunk[T any] struct {
	Objects []T
	Pos     int32
}

func Get

func Get[T any](name string) *Chunk[T]

func GetById added in v0.1.43

func GetById[T any](id uint32) *Chunk[T]

func (*Chunk[T]) Get added in v0.1.39

func (c *Chunk[T]) Get() any

type IChunk added in v0.1.39

type IChunk interface {
	Get() any
}

type Info

type Info struct {
	Name       string `json:"name"`
	ChunkSize  int64  `json:"chunk_size"`
	TotalAlloc int64  `json:"total_alloc"`
	TotalGet   int64  `json:"total_get"`
	TotalPut   int64  `json:"total_put"`
}

func Stat

func Stat() []Info

type ManagedPooledChunk added in v0.1.39

type ManagedPooledChunk interface {
	ManagedGet(poolId uint32) any
	ManagedPooledChunk(pc PooledChunk)
}

type Pool

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

func Declare

func Declare[T any](chunkSize int64) *Pool

func NewPool

func NewPool[T any](chunkSize int64) *Pool

func (*Pool) ChunkSize added in v0.1.39

func (p *Pool) ChunkSize() int64

func (*Pool) Get

func (p *Pool) Get() IChunk

func (*Pool) Id added in v0.1.39

func (p *Pool) Id() uint32

func (*Pool) Name

func (p *Pool) Name() string

func (*Pool) Put

func (p *Pool) Put(chunk IChunk)

func (*Pool) ReflectType added in v0.1.38

func (p *Pool) ReflectType() reflect.Type

func (*Pool) TotalAlloc

func (p *Pool) TotalAlloc() int64

func (*Pool) TotalGet

func (p *Pool) TotalGet() int64

func (*Pool) TotalPut

func (p *Pool) TotalPut() int64

type PooledChunk added in v0.1.39

type PooledChunk struct {
	Pool  *Pool
	Chunk IChunk
}

Jump to

Keyboard shortcuts

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