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
- type Client
- type ClientConfig
- type Config
- type Principal
- type Request
- type Store
- func (s *Store) Close() error
- func (s *Store) ConsistentBackup(ctx context.Context, path string) error
- func (s *Store) Evaluate(ctx context.Context, scope firewallstate.Scope, req Request) (decision policy.Decision, resultErr error)
- func (s *Store) Handler() http.Handler
- func (s *Store) Ready(ctx context.Context) (resultErr error)
Constants ¶
const EvaluatePath = "/api/v1/policy-state/evaluate"
const HealthPath = "/api/v1/policy-state/health"
const MaxBytes = 64 << 20
const MaxRequestBytes = 16 << 20
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) 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.
type ClientConfig ¶
type ClientConfig struct {
URL, Token string
Timeout time.Duration
Transport http.RoundTripper
}
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 (*Store) ConsistentBackup ¶
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.