pub struct MaintenanceRepo { /* private fields */ }Expand description
PostgreSQL repository for archival, history pruning, and table maintenance.
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;Implementations§
Source§impl MaintenanceRepo
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;
impl MaintenanceRepo
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;Sourcepub fn new(pool: Pool<Postgres>) -> MaintenanceRepo
pub fn new(pool: Pool<Postgres>) -> MaintenanceRepo
Creates a maintenance repository backed by pool.
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;Sourcepub async fn archive_succeeded_older_than(
&self,
cutoff: DateTime<Utc>,
batch: i64,
) -> Result<u64, Error>
pub async fn archive_succeeded_older_than( &self, cutoff: DateTime<Utc>, batch: i64, ) -> Result<u64, Error>
Move succeeded jobs older than cutoff into jobs_archive (idempotent).
Returns number archived.
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;Sourcepub async fn delete_history_for_succeeded_older_than(
&self,
cutoff: DateTime<Utc>,
batch: i64,
) -> Result<(u64, u64), Error>
pub async fn delete_history_for_succeeded_older_than( &self, cutoff: DateTime<Utc>, batch: i64, ) -> Result<(u64, u64), Error>
Delete attempts + policy decisions for succeeded jobs older than cutoff.
Returns (attempts_deleted, policy_deleted).
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;Sourcepub async fn vacuum_analyze(&self) -> Result<(), Error>
pub async fn vacuum_analyze(&self) -> Result<(), Error>
Executes VACUUM ANALYZE on core job queue tables outside active transactions.
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;Sourcepub async fn get_maintenance_status(
&self,
) -> Result<Vec<TableMaintenanceInfo>, Error>
pub async fn get_maintenance_status( &self, ) -> Result<Vec<TableMaintenanceInfo>, Error>
Queries pg_stat_user_tables for dead tuple counts, live tuple counts, and vacuum timestamps.
§Examples
use azums::MaintenanceRepo;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let maintenance = MaintenanceRepo::new(pool);
let _ = maintenance;Trait Implementations§
Source§impl Clone for MaintenanceRepo
impl Clone for MaintenanceRepo
Source§fn clone(&self) -> MaintenanceRepo
fn clone(&self) -> MaintenanceRepo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for MaintenanceRepo
impl !UnwindSafe for MaintenanceRepo
impl Freeze for MaintenanceRepo
impl Send for MaintenanceRepo
impl Sync for MaintenanceRepo
impl Unpin for MaintenanceRepo
impl UnsafeUnpin for MaintenanceRepo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more