Documentation
¶
Overview ¶
Package system provides the internal system definition hosting scheduled runtime sweeps for organization lifecycle
Index ¶
- Constants
- Variables
- func Builder(paymentReminder PaymentReminderConfig, ...) registry.Builder
- type FileOrphanConfig
- type FileOrphanSweep
- type IntegrationLifecycleConfig
- type IntegrationLifecycleSweep
- type OrganizationDeleteConfig
- type OrganizationDeleteSweep
- type PaymentReminderConfig
- type PaymentReminderSweep
Constants ¶
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 // FileOrphanMinAge keeps uploads not yet attached to a parent out of the sweep FileOrphanMinAge = 7 * 24 * time.Hour )
Variables ¶
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() // FileOrphanOp is the operation ref for the file orphan sweep FileOrphanOp = types.OperationPayloadOf[FileOrphanSweep](). Policy(types.ExecutionPolicy{Scheduled: true, SkipRunRecord: true}). Schedule(&gala.Schedule{MinInterval: fileOrphanMinInterval, MaxInterval: fileOrphanMaxInterval}). CustomerSelectable(false). SkipDefaultLookback() )
var DefinitionID = types.NewDefinitionRef("def_01SYSTEM0000000000000000001")
DefinitionID is the canonical identifier for the system definition
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, fileOrphan FileOrphanConfig) registry.Builder
Builder returns the system definition hosting the scheduled runtime sweeps
Types ¶
type FileOrphanConfig ¶
type FileOrphanConfig struct {
// Enabled turns the sweep on
Enabled bool `json:"enabled" koanf:"enabled" default:"true" jsonschema:"default=true,description=Whether the file orphan sweep is enabled"`
// DryRun only logs the files that would be deleted
DryRun bool `` /* 129-byte string literal not displayed */
// MaxPerRun caps deletions per sweep
MaxPerRun int `` /* 126-byte string literal not displayed */
}
FileOrphanConfig configures the file orphan sweep
func (FileOrphanConfig) Sweep ¶
func (c FileOrphanConfig) Sweep() FileOrphanSweep
Sweep maps the operator configuration to its sweep defaults
type FileOrphanSweep ¶
type FileOrphanSweep struct {
// DryRun only logs the files that would be deleted
DryRun bool `json:"dryRun,omitempty"`
// MaxPerRun caps deletions in the cycle
MaxPerRun int `json:"maxPerRun,omitempty"`
}
FileOrphanSweep is one file orphan sweep cycle
func (FileOrphanSweep) Run ¶
func (s FileOrphanSweep) Run(ctx context.Context, req types.OperationRequest) (int, error)
Run hard deletes unreferenced file records older than FileOrphanMinAge, soft deleted ones included, or logs them under dry run, and returns the count
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
func (c IntegrationLifecycleConfig) Sweep() IntegrationLifecycleSweep
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
func (s IntegrationLifecycleSweep) Run(ctx context.Context, req types.OperationRequest) (int, error)
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 ¶
func (c OrganizationDeleteConfig) Sweep() OrganizationDeleteSweep
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 ¶
func (o OrganizationDeleteSweep) Run(ctx context.Context, req types.OperationRequest) (int, error)
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 ¶
func (c PaymentReminderConfig) Sweep() PaymentReminderSweep
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 ¶
func (p PaymentReminderSweep) Run(ctx context.Context, req types.OperationRequest) (int, error)
Run executes one payment reminder sweep and returns the number of dispatched notifications