expirysweeper

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	EventStore    *eventstore.Store
	PushCore      *pushcore.Client
	CheckInterval time.Duration
	MaxEventAge   time.Duration // Events older than this are deleted (default: 1h).
	Logger        zerolog.Logger
}

Config holds configuration for the expiry sweeper.

type Sweeper

type Sweeper struct {
	// contains filtered or unexported fields
}

Sweeper periodically drops events that have expired or grown too old. Two deletion triggers:

  1. Block-based: events past their ExpiryBlockHeight (KEY events have a protocol-driven expiry; SIGN events have ExpiryBlockHeight=0 and skip).
  2. Age-based: only UNSIGNED events (status CONFIRMED or IN_PROGRESS) older than MaxEventAge. SIGNED and later statuses carry local commitments and are preserved.

Dropping is safe because push chain is the source of truth: if a dropped event is still pending on push chain, the push chain pending-tx parser re-populates it on its next poll. Anything truly stale (no longer pending upstream) stays dropped, which is the desired cleanup behaviour.

func NewSweeper

func NewSweeper(cfg Config) *Sweeper

NewSweeper creates a new expiry sweeper.

func (*Sweeper) Start

func (s *Sweeper) Start(ctx context.Context)

Start begins the background sweep loop.

Jump to

Keyboard shortcuts

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