Help us shape the future of Go! Take the 2026 Go Developer Survey

viewerpolicy

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package viewerpolicy fences authorization snapshots against durable policy writes.

Index

Constants

This section is empty.

Variables

View Source
var ErrChanged = errors.New("viewer policy changed")

Functions

func Bump

func Bump(ctx context.Context, db *sql.DB) error

Bump publishes a configuration policy transition before releasing its lease barrier.

func CheckSharedConfigVersion

func CheckSharedConfigVersion(ctx context.Context, tx *sql.Tx, expected int64) error

CheckSharedConfigVersion rechecks the exact version captured by a held config policy lease using the same transaction that already fenced the durable viewer-policy epoch. A clustered caller must not substitute a separate pooled connection or silently ignore missing schema/errors. The epoch trigger on clusterconfig_shared prevents a writer from committing a new shared version while that fence is held. This is not authorization.

func Fence

func Fence(ctx context.Context, db *sql.DB, tx *sql.Tx, expected int64) error

Fence locks the epoch until commit. PostgreSQL policy triggers update this same row. SQLite explicitly obtains the write lock even on connections that use deferred transactions; it must not rely on a particular DSN.

func Read

func Read(ctx context.Context, db *sql.DB) (int64, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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