logic

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const EventDidNotMatch = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type CatchEventSatisfier

type CatchEventSatisfier struct {
	schema.CatchEventInterface
	// contains filtered or unexported fields
}

CatchEventSatisfier is an algorithm that allows to apply events to a schema.CatchEventInterface element and obtain a determination whether all conditions were satisfied.

func NewCatchEventSatisfier

func NewCatchEventSatisfier(catchEventElement schema.CatchEventInterface, eventDefinitionInstanceBuilder event.IDefinitionInstanceBuilder) *CatchEventSatisfier

func (*CatchEventSatisfier) EventDefinitionInstances

func (satisfier *CatchEventSatisfier) EventDefinitionInstances() *[]event.IDefinitionInstance

func (*CatchEventSatisfier) Satisfy

func (satisfier *CatchEventSatisfier) Satisfy(ev event.IEvent) (matched bool, chain int)

Satisfy matches an event against event definitions in CatchEvent element, if all conditions are satisfied, it'll return true, otherwise, false.

Satisfy also returns the index of the chain operated on. Chain is a partial receipt of a parallel multiple event sequence.

  • If event didn't match, the value will be equal to EventDidNotMatch
  • If event matched, `chain` will be the matching chain's index
  • If event matched and it was not a parallel multiple catch event, or parallel multiple with just one event definition, `chain` will be equal to `0`

It is important to mention how chains get re-ordered upon their removal. Chain with the largest index (the last one) gets moved to the index of the removed chain and the array is shrunk by one element at the end. The knowledge of this behavior is important for being able to mirror changes if necessary.

Please note that Satisfy is NOT goroutine-safe and if you need to use it from multiple goroutines, wrap its usage with appropriate level of synchronization.

Jump to

Keyboard shortcuts

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