Module commit_thread

Module commit_thread 

Source
Expand description

Background commit timer and synchronous commit helpers.

Due to SQLite’s threading constraints (rusqlite::Connection is not Sync), we use a timer-based approach where:

  • A background thread tracks elapsed time
  • When commit time arrives, it sets a flag
  • The actual commit is performed synchronously by the caller

This module provides:

  • CommitTimer - Background timer that signals when commits are due
  • commit_now - Synchronous commit helper
  • CommitConfig - Configuration for commit behavior

Structs§

CommitConfig
Commit worker configuration
CommitTimer
A timer that signals when commits are due.

Constants§

DEFAULT_COMMIT_INTERVAL
Default commit interval (1 minute)
MIN_COMMIT_INTERVAL
Minimum commit interval

Functions§

commit_now
Synchronous commit helper (for forced commits from main thread)
force_commit_sync
Force a commit and wait for completion

Type Aliases§

CommitWorker
Legacy CommitWorker type alias for backwards compatibility