heropool

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RandomEjection = EjectionMode("random-ejection")
	LRUEjection    = EjectionMode("lru-ejection")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EIndex

type EIndex uint32

EIndex is data type representing an entity index in Pool.

type EjectionMode

type EjectionMode string

type Pool

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

func NewHeroPool

func NewHeroPool(sizeLimit uint32, ejectionMode EjectionMode) *Pool

func (*Pool) Add

func (p *Pool) Add(entityId flow.Identifier, entity flow.Entity, owner uint64) EIndex

Add writes given entity into a poolEntity on the underlying entities linked-list. Return value is the index at which given entity is written on entities linked-list so that it can be accessed directly later.

func (Pool) All added in v0.24.1

func (p Pool) All() []PoolEntity

All returns all stored entities in this pool.

func (Pool) Get

func (p Pool) Get(entityIndex EIndex) (flow.Identifier, flow.Entity, uint64)

Get returns entity corresponding to the entity index from the underlying list.

func (*Pool) Rem

func (p *Pool) Rem(sliceIndex EIndex)

Rem removes entity corresponding to given getSliceIndex from the list.

func (Pool) Size

func (p Pool) Size() uint32

Size returns total number of entities that this list maintains.

type PoolEntity added in v0.24.1

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

func (PoolEntity) Entity added in v0.24.1

func (p PoolEntity) Entity() flow.Entity

func (PoolEntity) Id added in v0.24.1

func (p PoolEntity) Id() flow.Identifier

Jump to

Keyboard shortcuts

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