Documentation
¶
Index ¶
- func New(instanceID int64, syncLegacyTables bool, cfg *config.Config) *sweeper
- type CleanupManager
- type ConfigExpiryQuerier
- type InstanceKey
- type LRDBExpiryQuerier
- type LogCleanupWorkItem
- type MetricCleanupWorkItem
- type PubSubHistoryQuerier
- type SyncQuerier
- type TraceCleanupWorkItem
- type WorkItem
- type WorkItemHeap
- type WorkQueueCleanupQuerier
- type WorkScheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CleanupManager ¶ added in v1.3.5
type CleanupManager struct {
// contains filtered or unexported fields
}
CleanupManager manages the domain-specific cleanup logic for a signal type
type ConfigExpiryQuerier ¶ added in v1.4.1
type ConfigExpiryQuerier interface {
// GetActiveOrganizations returns all enabled organizations
GetActiveOrganizations(ctx context.Context) ([]configdb.GetActiveOrganizationsRow, error)
// GetOrganizationExpiry retrieves expiry configuration for an org/signal pair
GetOrganizationExpiry(ctx context.Context, arg configdb.GetOrganizationExpiryParams) (configdb.OrganizationSignalExpiry, error)
// GetExpiryLastRun retrieves when expiry was last run for an org/signal pair
GetExpiryLastRun(ctx context.Context, arg configdb.GetExpiryLastRunParams) (configdb.ExpiryRunTracking, error)
// UpsertExpiryRunTracking creates or updates expiry run tracking
UpsertExpiryRunTracking(ctx context.Context, arg configdb.UpsertExpiryRunTrackingParams) error
}
ConfigExpiryQuerier defines the configdb operations needed for expiry cleanup
type InstanceKey ¶ added in v1.3.5
InstanceKey represents an organization and instance number combination
type LRDBExpiryQuerier ¶ added in v1.4.1
type LRDBExpiryQuerier interface {
// CallFindOrgPartition finds the organization's partition for a given table
CallFindOrgPartition(ctx context.Context, arg lrdb.CallFindOrgPartitionParams) (string, error)
// CallExpirePublishedByIngestCutoff expires data older than the cutoff date
CallExpirePublishedByIngestCutoff(ctx context.Context, arg lrdb.CallExpirePublishedByIngestCutoffParams) (int64, error)
}
LRDBExpiryQuerier defines the lrdb operations needed for expiry cleanup
type LogCleanupWorkItem ¶ added in v1.3.5
type LogCleanupWorkItem struct {
OrganizationID uuid.UUID
DateInt int32
NextRunTime time.Time
ConsecutiveEmpty int
// contains filtered or unexported fields
}
LogCleanupWorkItem implements WorkItem for log segment cleanup
func (*LogCleanupWorkItem) GetKey ¶ added in v1.3.5
func (w *LogCleanupWorkItem) GetKey() string
func (*LogCleanupWorkItem) GetNextRunTime ¶ added in v1.3.5
func (w *LogCleanupWorkItem) GetNextRunTime() time.Time
func (*LogCleanupWorkItem) Perform ¶ added in v1.3.5
func (w *LogCleanupWorkItem) Perform(ctx context.Context) time.Duration
func (*LogCleanupWorkItem) SetNextRunTime ¶ added in v1.3.5
func (w *LogCleanupWorkItem) SetNextRunTime(t time.Time)
type MetricCleanupWorkItem ¶ added in v1.3.5
type MetricCleanupWorkItem struct {
OrganizationID uuid.UUID
DateInt int32
NextRunTime time.Time
ConsecutiveEmpty int
// contains filtered or unexported fields
}
MetricCleanupWorkItem implements WorkItem for metric segment cleanup
func (*MetricCleanupWorkItem) GetKey ¶ added in v1.3.5
func (w *MetricCleanupWorkItem) GetKey() string
func (*MetricCleanupWorkItem) GetNextRunTime ¶ added in v1.3.5
func (w *MetricCleanupWorkItem) GetNextRunTime() time.Time
func (*MetricCleanupWorkItem) Perform ¶ added in v1.3.5
func (w *MetricCleanupWorkItem) Perform(ctx context.Context) time.Duration
func (*MetricCleanupWorkItem) SetNextRunTime ¶ added in v1.3.5
func (w *MetricCleanupWorkItem) SetNextRunTime(t time.Time)
type PubSubHistoryQuerier ¶ added in v1.4.0
type PubSubHistoryQuerier interface {
PubSubMessageHistoryCleanup(ctx context.Context, params lrdb.PubSubMessageHistoryCleanupParams) (pgconn.CommandTag, error)
}
PubSubHistoryQuerier defines the interface needed for pubsub history cleanup
type SyncQuerier ¶ added in v1.4.0
type SyncQuerier interface {
GetAllCOrganizations(ctx context.Context) ([]configdb.GetAllCOrganizationsRow, error)
GetAllOrganizations(ctx context.Context) ([]configdb.GetAllOrganizationsRow, error)
UpsertOrganizationSync(ctx context.Context, arg configdb.UpsertOrganizationSyncParams) error
DeleteOrganizationsNotInList(ctx context.Context, idsToDelete []uuid.UUID) error
GetAllCBucketData(ctx context.Context) ([]configdb.GetAllCBucketDataRow, error)
GetAllBucketConfigurations(ctx context.Context) ([]configdb.GetAllBucketConfigurationsRow, error)
GetAllOrganizationBucketMappings(ctx context.Context) ([]configdb.GetAllOrganizationBucketMappingsRow, error)
UpsertBucketConfiguration(ctx context.Context, arg configdb.UpsertBucketConfigurationParams) (configdb.BucketConfiguration, error)
UpsertOrganizationBucket(ctx context.Context, arg configdb.UpsertOrganizationBucketParams) error
DeleteOrganizationBucketMappings(ctx context.Context, arg configdb.DeleteOrganizationBucketMappingsParams) error
GetAllCOrganizationAPIKeys(ctx context.Context) ([]configdb.GetAllCOrganizationAPIKeysRow, error)
GetAllOrganizationAPIKeyMappings(ctx context.Context) ([]configdb.GetAllOrganizationAPIKeyMappingsRow, error)
UpsertOrganizationAPIKey(ctx context.Context, arg configdb.UpsertOrganizationAPIKeyParams) (configdb.OrganizationApiKey, error)
UpsertOrganizationAPIKeyMapping(ctx context.Context, arg configdb.UpsertOrganizationAPIKeyMappingParams) error
DeleteOrganizationAPIKeyMappingByHash(ctx context.Context, arg configdb.DeleteOrganizationAPIKeyMappingByHashParams) error
}
SyncQuerier interface for sync operations (testable)
type TraceCleanupWorkItem ¶ added in v1.3.5
type TraceCleanupWorkItem struct {
OrganizationID uuid.UUID
DateInt int32
NextRunTime time.Time
ConsecutiveEmpty int
// contains filtered or unexported fields
}
TraceCleanupWorkItem implements WorkItem for trace segment cleanup
func (*TraceCleanupWorkItem) GetKey ¶ added in v1.3.5
func (w *TraceCleanupWorkItem) GetKey() string
func (*TraceCleanupWorkItem) GetNextRunTime ¶ added in v1.3.5
func (w *TraceCleanupWorkItem) GetNextRunTime() time.Time
func (*TraceCleanupWorkItem) Perform ¶ added in v1.3.5
func (w *TraceCleanupWorkItem) Perform(ctx context.Context) time.Duration
func (*TraceCleanupWorkItem) SetNextRunTime ¶ added in v1.3.5
func (w *TraceCleanupWorkItem) SetNextRunTime(t time.Time)
type WorkItem ¶ added in v1.3.5
type WorkItem interface {
// Perform executes the work and returns the duration until it should run again.
// Negative values indicate the work item should be dropped/removed.
Perform(ctx context.Context) time.Duration
// GetNextRunTime returns when this work should next be executed
GetNextRunTime() time.Time
// SetNextRunTime updates when this work should next be executed
SetNextRunTime(t time.Time)
// GetKey returns a unique key for this work item (for tracking)
GetKey() string
}
WorkItem represents a cleanup task that can perform work
type WorkItemHeap ¶ added in v1.3.5
type WorkItemHeap []WorkItem
WorkItemHeap implements heap.Interface for WorkItem
func (WorkItemHeap) Len ¶ added in v1.3.5
func (h WorkItemHeap) Len() int
func (WorkItemHeap) Less ¶ added in v1.3.5
func (h WorkItemHeap) Less(i, j int) bool
func (*WorkItemHeap) Pop ¶ added in v1.3.5
func (h *WorkItemHeap) Pop() any
func (*WorkItemHeap) Push ¶ added in v1.3.5
func (h *WorkItemHeap) Push(x any)
func (WorkItemHeap) Swap ¶ added in v1.3.5
func (h WorkItemHeap) Swap(i, j int)
type WorkQueueCleanupQuerier ¶ added in v1.6.0
WorkQueueCleanupQuerier defines the interface needed for work queue cleanup
type WorkScheduler ¶ added in v1.3.5
type WorkScheduler struct {
// contains filtered or unexported fields
}
WorkScheduler manages work items in a generic, domain-agnostic way