Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithReferenceValidator ¶
func WithReferenceValidator[ID slot.IndexedID, Entity OrderedEntity[ID]](referenceValidator func(entity Entity, parent Entity) (err error)) options.Option[CausalOrder[ID, Entity]]
WithReferenceValidator is an option that sets the ReferenceValidator of the CausalOrder.
Types ¶
type CausalOrder ¶
type CausalOrder[ID slot.IndexedID, Entity OrderedEntity[ID]] struct { // contains filtered or unexported fields }
CausalOrder represents an order where an Entity is ordered after its causal dependencies (parents) have been ordered.
func New ¶
func New[ID slot.IndexedID, Entity OrderedEntity[ID]]( workerPool *workerpool.WorkerPool, entityProvider func(id ID) (entity Entity, exists bool), isOrdered func(entity Entity) (isOrdered bool), orderedCallback func(entity Entity) (err error), evictionCallback func(entity Entity, reason error), parentsCallback func(entity Entity) []ID, opts ...options.Option[CausalOrder[ID, Entity]], ) (newCausalOrder *CausalOrder[ID, Entity])
New returns a new CausalOrderer instance with the given parameters.
func (*CausalOrder[ID, Entity]) EvictUntil ¶
func (c *CausalOrder[ID, Entity]) EvictUntil(index slot.Index)
EvictUntil removes all Entities that are older than the given slot from the CausalOrder.
func (*CausalOrder[ID, Entity]) Queue ¶
func (c *CausalOrder[ID, Entity]) Queue(entity Entity)
Queue adds the given Entity to the CausalOrderer and triggers it when it's ready.
type OrderedEntity ¶
type OrderedEntity[ID slot.IndexedID] interface { // ID returns the ID of the Entity. ID() ID // comparable embeds the comparable interface. comparable }
OrderedEntity is an interface that represents an Entity that can be causally ordered.
Click to show internal directories.
Click to hide internal directories.