system

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package system provides the internal system definition hosting scheduled runtime sweeps for organization lifecycle

Index

Constants

View Source
const (
	// DefaultPaymentMethodInterval is the default number of days after org creation
	// before an org without a payment method is marked for deletion
	DefaultPaymentMethodInterval = 30
	// DefaultDeletionDays is the default number of days between marking an org
	// for deletion and the actual deletion
	DefaultDeletionDays = 7
	// PaymentReminderMinInterval is the minimum polling interval for payment reminder sweeps
	PaymentReminderMinInterval = 6 * time.Hour
	// PaymentReminderMaxInterval is the maximum polling interval for payment reminder sweeps
	PaymentReminderMaxInterval = 24 * time.Hour
	// DefaultOrganizationDeleteMaxPerRun is the default maximum number of orgs deleted per sweep
	DefaultOrganizationDeleteMaxPerRun = 25
	// OrganizationDeleteMinInterval is the minimum polling interval for organization deletion sweeps
	OrganizationDeleteMinInterval = 24 * time.Hour
	// OrganizationDeleteMaxInterval is the maximum polling interval for organization deletion sweeps
	OrganizationDeleteMaxInterval = 24 * time.Hour
)

Variables

View Source
var (
	// ErrResultEncode indicates an operation result payload could not be encoded
	ErrResultEncode = errors.New("system: failed to encode operation result")
	// ErrOperationConfigInvalid indicates an operation config payload could not be decoded
	ErrOperationConfigInvalid = errors.New("system: operation config invalid")
)
View Source
var (
	_, PaymentReminderOp = providerkit.OperationSchema[PaymentReminderSweep]()
	_,//nolint:revive
	OrganizationDeleteOp = providerkit.OperationSchema[OrganizationDeleteSweep]() //nolint:revive
)
View Source
var DefinitionID = types.NewDefinitionRef("def_01SYSTEM0000000000000000001")

DefinitionID is the canonical identifier for the system definition

Functions

func Builder

func Builder(paymentReminder PaymentReminderConfig, organizationDelete OrganizationDeleteConfig) registry.Builder

Builder returns the system definition hosting the scheduled runtime sweeps; it exposes no credentials, clients, or connections and is never visible in catalog surfaces

Types

type OrganizationDeleteConfig

type OrganizationDeleteConfig struct {
	// MaxDeletesPerRun caps how many overdue organizations are deleted per sweep
	MaxDeletesPerRun int `` /* 132-byte string literal not displayed */
	// Enabled controls whether the organization deletion sweep is seeded at startup
	Enabled bool `json:"enabled" koanf:"enabled" jsonschema:"description=Whether the organization deletion listener is enabled"`
}

OrganizationDeleteConfig contains the operator configuration for the organization deletion sweep

func (OrganizationDeleteConfig) Sweep

Sweep maps the operator configuration to its sweep defaults

type OrganizationDeleteSweep

type OrganizationDeleteSweep struct {
	// MaxDeletesPerRun caps how many overdue organizations are deleted during the cycle
	MaxDeletesPerRun int `json:"maxDeletesPerRun,omitempty"`
}

OrganizationDeleteSweep configures one organization deletion sweep cycle

func (OrganizationDeleteSweep) Handle

Handle adapts the organization deletion sweep to the generic operation registration boundary; the receiver carries the operator defaults and request config overlays a copy

func (OrganizationDeleteSweep) Run

Run executes one organization deletion sweep and returns the number of deleted organizations

type PaymentReminderConfig

type PaymentReminderConfig struct {
	// PaymentMethodInterval is the number of days after org creation before
	// an org without a payment method is marked for deletion
	PaymentMethodInterval uint8 `` /* 146-byte string literal not displayed */
	// DeletionDays is the number of days between marking an org for deletion
	// and the actual deletion date set on pending_deletion_at
	DeletionDays uint8 `json:"deletiondays" koanf:"deletiondays" jsonschema:"default=7,description=Days between marking and actual deletion"`
	// Enabled controls whether the payment reminder sweep is seeded at startup
	Enabled bool `json:"enabled" koanf:"enabled" jsonschema:"default=false,description=Whether the payment reminder listener is enabled"`
	// DryRun logs matching organization IDs without mutating state or dispatching emails
	DryRun bool `json:"dryrun" koanf:"dryrun" jsonschema:"default=true,description=If true only log organization IDs that would be processed"`
}

PaymentReminderConfig contains the operator configuration for the payment reminder sweep

func (PaymentReminderConfig) Sweep

Sweep maps the operator configuration to its sweep defaults

type PaymentReminderSweep

type PaymentReminderSweep struct {
	// PaymentMethodInterval is the number of days after cancellation before an org is marked for deletion
	PaymentMethodInterval uint8 `json:"paymentMethodInterval,omitempty"`
	// DeletionDays is the number of days between marking an org for deletion and the actual deletion
	DeletionDays uint8 `json:"deletionDays,omitempty"`
	// DryRun logs matching organization IDs without mutating state or dispatching emails
	DryRun bool `json:"dryRun,omitempty"`
}

PaymentReminderSweep configures one payment reminder sweep cycle

func (PaymentReminderSweep) Handle

Handle adapts the payment reminder sweep to the generic operation registration boundary; the receiver carries the operator defaults and request config overlays a copy

func (PaymentReminderSweep) Run

Run executes one payment reminder sweep and returns the number of dispatched notifications

Jump to

Keyboard shortcuts

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