Skip to main content

handle_db_versioning

Function handle_db_versioning 

Source
pub fn handle_db_versioning(
    base_path: &Path,
    version_info: &GitVersionInfo<'_>,
    is_ci: bool,
) -> Result<PathBuf>
Expand description

Given a base path, creates a version directory for the given version_info. Automatically cleans up old/stale databases.

The current version is always retained. Alongside it, exactly one database whose version isn’t the current one is kept — the most recently used, and only if it was used within [DEFAULT_OTHER_DB_VERSION_TTL_DAYS] — so that switching back to a branch you recently left still finds its cache intact. On CI none are retained.

Environment Variables

  • TURBO_ENGINE_VERSION: Forces use of a specific database version.
  • TURBO_ENGINE_IGNORE_DIRTY: Enable filesystem cache in a dirty git repository. Otherwise a temporary directory is created.
  • TURBO_ENGINE_DISABLE_VERSIONING: Ignores versioning and always uses the same “unversioned” database when set.
  • TURBO_ENGINE_VERSION_TTL_DAYS: How many days to retain a database whose version isn’t the current one, as a whole number. Overrides [DEFAULT_OTHER_DB_VERSION_TTL_DAYS].