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

system

package
v2.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 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 days before an org is marked for deletion
	DefaultPaymentMethodInterval = 30
	// DefaultDeletionDays is the default days between marking and deleting an org
	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 caps 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 (
	// PaymentReminderOp is the operation ref for the payment reminder sweep
	PaymentReminderOp = types.OperationPayloadOf[PaymentReminderSweep]().
						Policy(types.ExecutionPolicy{Scheduled: true, SkipRunRecord: true}).
						Schedule(&gala.Schedule{MinInterval: PaymentReminderMinInterval, MaxInterval: PaymentReminderMaxInterval}).
						CustomerSelectable(false).
						SkipDefaultLookback()
	// OrganizationDeleteOp is the operation ref for the organization deletion sweep
	OrganizationDeleteOp = types.OperationPayloadOf[OrganizationDeleteSweep]().
							Policy(types.ExecutionPolicy{Scheduled: true, SkipRunRecord: true}).
							Schedule(&gala.Schedule{MinInterval: OrganizationDeleteMinInterval, MaxInterval: OrganizationDeleteMaxInterval}).
							CustomerSelectable(false).
							SkipDefaultLookback()
	// IntegrationLifecycleOp is the operation ref for the integration lifecycle sweep
	IntegrationLifecycleOp = types.OperationPayloadOf[IntegrationLifecycleSweep]().
							Policy(types.ExecutionPolicy{Scheduled: true, SkipRunRecord: true}).
							Schedule(&gala.Schedule{MinInterval: IntegrationLifecycleMinInterval, MaxInterval: IntegrationLifecycleMaxInterval}).
							CustomerSelectable(false).
							SkipDefaultLookback()
)
View Source
var DefinitionID = types.NewDefinitionRef("def_01SYSTEM0000000000000000001")

DefinitionID is the canonical identifier for the system definition

View Source
var (
	// ErrResultEncode indicates an operation result payload could not be encoded
	ErrResultEncode = errors.New("system: failed to encode operation result")
)

Functions

func Builder

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

Builder returns the system definition hosting the scheduled runtime sweeps

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 configures 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) 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) Run

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

type PaymentReminderConfig

type PaymentReminderConfig struct {
	// PaymentMethodInterval is the days after org creation before deletion is marked
	PaymentMethodInterval uint8 `` /* 146-byte string literal not displayed */
	// DeletionDays is the days between marking an org for deletion and deleting it
	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 days after cancellation before deletion is marked
	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) 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