system

package
v2.4.9 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 28 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
	// DefaultIntegrationLifecycleMaxPerRun is the default maximum number of integrations evaluated per sweep
	DefaultIntegrationLifecycleMaxPerRun = 100
	// IntegrationLifecycleMinInterval is the minimum polling interval for integration lifecycle sweeps
	IntegrationLifecycleMinInterval = 6 * time.Hour
	// IntegrationLifecycleMaxInterval is the maximum polling interval for integration lifecycle sweeps
	IntegrationLifecycleMaxInterval = 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
	IntegrationLifecycleOp = providerkit.OperationSchema[IntegrationLifecycleSweep]() //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, integrationLifecycle IntegrationLifecycleConfig) 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 IntegrationLifecycleConfig added in v2.4.8

type IntegrationLifecycleConfig struct {
	// Enabled controls whether the integration lifecycle sweep is seeded at startup
	Enabled bool `` /* 134-byte string literal not displayed */
	// DryRun logs matching integration IDs and actions without dispatching them
	DryRun bool `` /* 151-byte string literal not displayed */
	// MaxPerRun caps how many integrations are evaluated per sweep
	MaxPerRun int `` /* 126-byte string literal not displayed */
}

IntegrationLifecycleConfig contains the operator configuration for the integration lifecycle sweep

func (IntegrationLifecycleConfig) Sweep added in v2.4.8

Sweep maps the operator configuration to its sweep defaults

type IntegrationLifecycleSweep added in v2.4.8

type IntegrationLifecycleSweep struct {
	// DryRun logs matching integration IDs and actions without dispatching them
	DryRun bool `json:"dryRun,omitempty"`
	// MaxPerRun caps how many integrations are evaluated during the cycle
	MaxPerRun int `json:"maxPerRun,omitempty"`
}

IntegrationLifecycleSweep configures one integration lifecycle sweep cycle

func (IntegrationLifecycleSweep) Handle added in v2.4.8

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

func (IntegrationLifecycleSweep) Run added in v2.4.8

Run executes one integration lifecycle sweep and returns the number reaped

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