Parrhesia.Storage.Partitions
(parrhesia v0.12.0)
Copy Markdown
Partition lifecycle helpers for Postgres events and event_tags monthly partitions.
Summary
Functions
Returns the current database size in bytes.
Drops an event partition table by name.
Ensures monthly partitions exist for the current month and months_ahead future months.
Returns the monthly event_tags partition name for a date.
Lists monthly event partitions that match events_YYYY_MM naming.
Lists all events_* partitions excluding the default partition.
Returns the monthly events partition name for a date.
Types
@type monthly_partition() :: %{ name: String.t(), year: pos_integer(), month: pos_integer(), month_start_unix: non_neg_integer(), month_end_unix: non_neg_integer() }
Functions
@spec database_size_bytes() :: {:ok, non_neg_integer()} | {:error, term()}
Returns the current database size in bytes.
Drops an event partition table by name.
For monthly events_YYYY_MM partitions, the matching event_tags_YYYY_MM
partition is dropped first to keep partition lifecycle aligned.
Ensures monthly partitions exist for the current month and months_ahead future months.
Returns the monthly event_tags partition name for a date.
@spec list_monthly_partitions() :: [monthly_partition()]
Lists monthly event partitions that match events_YYYY_MM naming.
@spec list_partitions() :: [String.t()]
Lists all events_* partitions excluding the default partition.
Returns the monthly events partition name for a date.