engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	RuleID   string
	Chain    string
	SourceID string
	Height   uint64
	Hash     string
	TxHash   string
	LogIndex *uint
	AppID    uint64
	Args     map[string]any
}

type Predicate

type Predicate func(args map[string]any) (bool, error)

Predicate evaluates whether an event args map satisfies a condition.

func CompilePredicates

func CompilePredicates(exprs []string) ([]Predicate, error)

CompilePredicates parses simple expressions into executable predicates. Supported operators: ==, !=, >, <, in, contains. Examples:

"value > 10"
"sender in a,b,c"
"memo contains alert"

type Runner

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

Runner wires sources, predicates, dedupe, and sinks for a single pass.

func NewRunner

func NewRunner(store *storage.Store, cfg *config.Config, evmScanners map[string]*evm.Scanner, algoScanners map[string]*algorand.Scanner, sinks map[string]sink.Sender, dryRun bool, from, to uint64) (*Runner, error)

NewRunner builds a runner for the provided config and scanners.

func (*Runner) RunOnce

func (r *Runner) RunOnce(ctx context.Context) error

RunOnce processes one eligible block/round per source.

type TokenBucket

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

TokenBucket is a simple per-rule rate limiter.

func NewTokenBucket

func NewTokenBucket(capacity, rate float64) *TokenBucket

NewTokenBucket creates a token bucket with capacity and refill rate.

func (*TokenBucket) Allow

func (b *TokenBucket) Allow(now time.Time) bool

Allow consumes one token if available, refilling based on elapsed time.

Jump to

Keyboard shortcuts

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