Documentation
¶
Overview ¶
Package lease implements the lease enforcement primitives: glob match, target canonicalization, expires_at and budget checks.
Index ¶
- func CanonicalizePath(p string) string
- func CanonicalizeURL(raw string) (string, error)
- func IsSubset(parent, child arcp.Lease, parentRemaining map[arcp.Currency]float64, ...) error
- type State
- func (s *State) Budget() map[arcp.Currency]float64
- func (s *State) Debit(cur arcp.Currency, v float64) (float64, error)
- func (s *State) ExpiresAt() *time.Time
- func (s *State) HasBudget() bool
- func (s *State) Initial() map[arcp.Currency]float64
- func (s *State) Lease() arcp.Lease
- func (s *State) ValidateOp(now time.Time, cap arcp.Capability, target string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizePath ¶
CanonicalizePath collapses dot segments and double slashes. A leading slash is preserved.
func CanonicalizeURL ¶
CanonicalizeURL lowercases scheme/host and normalises path.
func IsSubset ¶
func IsSubset(parent, child arcp.Lease, parentRemaining map[arcp.Currency]float64, parentExpiry, childExpiry *time.Time) error
IsSubset reports whether child is a subset of parent: every child capability appears in parent and every child pattern is matched by at least one parent pattern. Budget patterns are compared numerically against parentRemaining.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds the runtime-mutable lease state for one job: the immutable lease, the optional expires_at deadline, and per-currency budget counters.
func (*State) Debit ¶
Debit subtracts v from the named currency counter. Returns the remaining balance and any error.
func (*State) ValidateOp ¶
ValidateOp checks that op (capability, target) is allowed under the lease at time now. Returns nil on success or a structured arcp.Error.