DurableStreams.Retention.Scheduler (Streamkeeper v0.3.0)

View Source

Periodic scheduler for stream retention/compaction.

This GenServer runs at regular intervals and:

  1. Queries all streams with retention policies
  2. Identifies streams that need compaction
  3. Spawns compaction tasks (with concurrency limits)
  4. Tracks in-progress compactions to avoid duplicates

Configuration

  • :interval - How often to check for compaction needs (default: 30 seconds)
  • :max_concurrent - Maximum concurrent compaction tasks (default: 5)

Summary

Functions

Triggers an immediate compaction check. Useful for testing or manual intervention.

Returns a specification to start this module under a supervisor.

Returns the current scheduler state for debugging.

Functions

check_now()

@spec check_now() :: :ok

Triggers an immediate compaction check. Useful for testing or manual intervention.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

status()

@spec status() :: map()

Returns the current scheduler state for debugging.