rule

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package rule is the server-side admission-controller pre-gate (D4). A rule observes a typed input (the triggering event + the projection it was dispatched on) and returns a rich RuleDecision — it PROPOSES or ENQUEUES, but never writes (S12: a rule holds no Store/Kernel). The kernel stays the only canonical writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NativeRule

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

NativeRule is a Go-implemented admission rule.

func NewNativeRule

func NewNativeRule(id string, actor contract.ActorID, emits string, handles []string, fn func(RuleInput) (contract.RuleDecision, error)) NativeRule

func (NativeRule) Actor

func (r NativeRule) Actor() contract.ActorID

func (NativeRule) Emits

func (r NativeRule) Emits() string

func (NativeRule) Evaluate

func (r NativeRule) Evaluate(in RuleInput) (contract.RuleDecision, error)

func (NativeRule) Handles

func (r NativeRule) Handles(t string) bool

func (NativeRule) ID

func (r NativeRule) ID() string

type Rule

type Rule interface {
	ID() string
	Actor() contract.ActorID
	Emits() string
	Handles(eventType string) bool
	Evaluate(RuleInput) (contract.RuleDecision, error)
}

Rule is one admission rule. Actor()/Emits() let the server synthesize a trusted ResolvedBinding for the bridge when a rule proposes (the proposal's write identity + authorized emit type come from the rule, never the payload). Handles gates which event types it sees.

type RuleInput

type RuleInput struct {
	Event contract.Event
	View  projection.Projection
}

RuleInput is the typed, read-only input to a rule: the triggering event and the scoped projection it was dispatched on. (Held by rule, not contract, so the projection.Projection dependency lives off the wire — D11.)

type RuleSet

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

RuleSet is an ordered set of rules reduced by a DENY-PRIORITY policy.

func NewRuleSet

func NewRuleSet(rules ...Rule) RuleSet

func (RuleSet) Evaluate

Evaluate reduces every handling rule into one decision (deny-priority) plus diagnostics. An erroring rule contributes ZERO intent and exactly one Diagnostic naming it (S7 / Invariant #13). Warn reasons attach to the final decision; the first proposal for the winning verdict is carried.

func (RuleSet) Rules

func (rs RuleSet) Rules() []Rule

Rules exposes the member rules so the server can find the rule that produced a proposal (to stamp the trusted bridge binding from its Actor()/Emits()).

type ShadowReport

type ShadowReport struct {
	Clean bool
	Diffs int
}

ShadowReport is the diff of a candidate policy vs the live policy over the same event log (S8). It is owned HERE (not replay) so replay->rule stays one-way (D11/blocker #4): replay imports rule.ShadowReport, while rule never imports replay. It reports diffs, never pass/fail.

Jump to

Keyboard shortcuts

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