eventpolicy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package eventpolicy provides a built-in event publish policy that enforces module capability checks on event publication.

When no PublishPolicyProvider is registered, the event bus denies all event publication (deny-by-default). Deployments must explicitly wire a policy — either this built-in one or a custom module-provided one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuiltinPolicy

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

BuiltinPolicy is the default event publish policy that enforces module capability checks. When strict mode is enabled (MUXCORE_STRICT_PUBLISH_POLICY=true), events from modules that lack a matching capability for the event type are denied. In non-strict mode (default), all events are allowed but capability mismatches are logged as warnings — this provides soft enforcement during migration.

func NewBuiltinPolicy

func NewBuiltinPolicy(reg contracts.Registry) *BuiltinPolicy

NewBuiltinPolicy creates a policy backed by the given registry. Set MUXCORE_STRICT_PUBLISH_POLICY=true to enable hard denial of capability-mismatched event publication.

func (*BuiltinPolicy) CanPublish

func (p *BuiltinPolicy) CanPublish(ctx context.Context, callerID, eventType string) (bool, error)

CanPublish implements contracts.PublishPolicyProvider. Core (bootstrap) events with an empty caller ID are always allowed. Module events are checked against the caller's declared capabilities.

func (*BuiltinPolicy) Strict

func (p *BuiltinPolicy) Strict() bool

Strict reports whether hard denial is active.

Jump to

Keyboard shortcuts

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