Documentation
¶
Overview ¶
Package tenantpolicy defines CloudPath's v0.1 anti-abuse limits and tenant-scoped retention policy. It is a pure domain package; persistence and HTTP/WS wiring live in store/server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPolicy = errors.New("tenantpolicy: invalid policy") ErrQuotaExceeded = errors.New("tenantpolicy: quota exceeded") )
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter atomically admits and releases concurrent resources such as Edge or browser WebSocket connections. A release function is idempotent.
func NewCounter ¶
func NewCounter() *Counter
type Policy ¶
type Policy struct {
Retention RetentionDays
Quotas Quotas
}
Policy is the resolved policy used by runtime enforcement.
type QuotaError ¶
QuotaError carries only non-sensitive usage facts.
func (*QuotaError) Code ¶
func (e *QuotaError) Code() string
func (*QuotaError) Error ¶
func (e *QuotaError) Error() string
func (*QuotaError) Unwrap ¶
func (e *QuotaError) Unwrap() error
type Quotas ¶
type Quotas struct {
Devices int
Edges int
BrowserWS int
Tokens int
Users int
EventsPerMinute int
PluginInstances int
}
Quotas contains resolved hard limits. Zero/unlimited is deliberately invalid.
type Resource ¶
type Resource string
Resource is a stable machine identifier used by HTTP error codes and audit.
type RetentionDays ¶
type RetentionDays struct {
Events int
TerminalCommands int
Audit int
RevokedTokens int
PluginObservations int
}
RetentionDays contains resolved, non-null retention values.
type WindowLimiter ¶
type WindowLimiter struct {
// contains filtered or unexported fields
}
WindowLimiter is an in-memory fixed-window limiter for high-rate resources such as events. It is tenant/resource scoped and uses an injectable clock.
func NewWindowLimiter ¶
func NewWindowLimiter(window time.Duration, now func() time.Time) *WindowLimiter