queue

package
v0.42.5-cadence-compil... Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdentifierOfMessage added in v0.43.0

func IdentifierOfMessage(msg *engine.Message) flow.Identifier

IdentifierOfMessage generates the unique identifier for a message.

func IdentifierOfMessageWithNonce added in v0.43.0

func IdentifierOfMessageWithNonce(msg *engine.Message) flow.Identifier

IdentifierOfMessageWithNonce generates an identifier with a nonce to prevent de-duplication.

Types

type HeroQueue added in v0.29.0

type HeroQueue[V any] struct {
	// contains filtered or unexported fields
}

HeroQueue is a generic in-memory queue implementation based on HeroCache. HeroCache is a key-value cache with zero heap allocation and optimized Garbage Collection.

func NewHeroQueue added in v0.29.0

func NewHeroQueue[V any](sizeLimit uint32, logger zerolog.Logger, collector module.HeroCacheMetrics) *HeroQueue[V]

NewHeroQueue creates a new instance of HeroQueue with the specified size limit.

func (*HeroQueue[V]) Pop added in v0.29.0

func (c *HeroQueue[V]) Pop() (value V, ok bool)

Pop removes and returns the head of queue, and updates the head to the next element. Boolean return value determines whether pop is successful, i.e., popping an empty queue returns false.

func (*HeroQueue[V]) Push added in v0.29.0

func (c *HeroQueue[V]) Push(key flow.Identifier, value V) bool

Push stores the key-value pair into the queue. Boolean returned variable determines whether push was successful, i.e., push may be dropped if queue is full or already exists.

func (*HeroQueue[V]) Size added in v0.29.0

func (c *HeroQueue[V]) Size() uint

Size returns the number of elements currently stored in the queue.

type HeroStore added in v0.29.0

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

HeroStore is a FIFO (first-in-first-out) size-bound queue for maintaining engine.Message types. It is based on HeroQueue.

func NewHeroStore added in v0.29.0

func NewHeroStore(sizeLimit uint32, logger zerolog.Logger, collector module.HeroCacheMetrics, opts ...HeroStoreOption) *HeroStore

func (*HeroStore) Get added in v0.29.0

func (c *HeroStore) Get() (*engine.Message, bool)

Get pops the queue, i.e., it returns the head of queue, and updates the head to the next element. Boolean return value determines whether pop is successful, i.e., popping an empty queue returns false.

func (*HeroStore) Put added in v0.29.0

func (c *HeroStore) Put(message *engine.Message) bool

Put enqueues the message into the message store.

Boolean returned variable determines whether enqueuing was successful, i.e., put may be dropped if queue is full or already exists.

func (*HeroStore) Size added in v0.43.0

func (c *HeroStore) Size() uint

type HeroStoreOption added in v0.33.30

type HeroStoreOption func(heroStore *HeroStore)

func WithMessageKeyFactory added in v0.43.0

func WithMessageKeyFactory(f KeyFunc) HeroStoreOption

WithMessageKeyFactory allows setting a custom function to generate the key for a message.

type KeyFunc added in v0.43.0

type KeyFunc func(msg *engine.Message) flow.Identifier

KeyFunc defines a function type for computing the unique identifier for a message.

Jump to

Keyboard shortcuts

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