policystate

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package policystate evaluates native policies in an authoritative transaction. No request/event payload is persisted. PostgreSQL serializes the namespace (stronger than per-scope/revision locking); SQLite is a fenced WAL singleton.

Index

Constants

View Source
const EvaluatePath = "/api/v1/policy-state/evaluate"
View Source
const HealthPath = "/api/v1/policy-state/health"
View Source
const MaxBytes = 64 << 20
View Source
const MaxRequestBytes = 16 << 20
View Source
const MaxRevisions = 64

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Operations *runtimeobs.Monitor
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Evaluate

func (c *Client) Evaluate(ctx context.Context, p *policy.Compiled, e policy.Event) (decision policy.Decision, resultErr error)

Evaluate pins the supplied descriptor. Every attempt includes its artifact so expired artifact reclamation needs no mutation retry. There is exactly one HTTP attempt; an ambiguous failure never falls back to local state or resubmits.

func (*Client) Probe

func (c *Client) Probe(ctx context.Context) error

func (*Client) Ready

func (c *Client) Ready() bool

type ClientConfig

type ClientConfig struct {
	URL, Token string
	Timeout    time.Duration
	Transport  http.RoundTripper
}

type Config

type Config struct {
	Auth                        *firewallauth.Authority
	Environment, Target, Origin string
	StateDir                    string
	DatabaseURL                 string
	DatabaseNamespace           string
	Principals                  []Principal
	AllowEffects                bool
	MaxRevisions                int
	MaxStateBytes               int
}

type Principal

type Principal struct {
	ID    string
	Token string
	Scope firewallstate.Scope
}

type Request

type Request struct {
	Revision string          `json:"revision"`
	Bundle   json.RawMessage `json:"bundle,omitempty"`
	Event    *policy.Event   `json:"event"`
}

type Store

type Store struct {
	Operations *runtimeobs.Monitor
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) ConsistentBackup

func (s *Store) ConsistentBackup(ctx context.Context, path string) error

func (*Store) Evaluate

func (s *Store) Evaluate(ctx context.Context, scope firewallstate.Scope, req Request) (decision policy.Decision, resultErr error)

Evaluate is a trusted in-process boundary. HTTP callers cannot supply Scope. Commit errors return no decision and are never retried, even if commit applied.

func (*Store) Handler

func (s *Store) Handler() http.Handler

func (*Store) Ready

func (s *Store) Ready(ctx context.Context) (resultErr error)

Jump to

Keyboard shortcuts

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