Skip to main content

type_bridge_migration/
lib.rs

1//! Migration specification IR for type-bridge.
2//!
3//! This crate defines the serde contract that Python migration authoring lowers
4//! into, plus pure validation, checksum gates, the transaction-aware planner,
5//! and the async executor that runs each step over a `Database`.
6
7#![deny(missing_docs)]
8
9// The legacy CLI source is shared by the standalone binary and the Python
10// extension. Give the library its package name so the shared module can keep
11// using the same absolute imports in both compilation contexts.
12extern crate self as type_bridge_migration;
13
14pub mod adoption;
15pub mod author;
16pub mod backfill;
17pub mod checksum;
18pub mod error;
19pub mod executor;
20pub mod graph;
21pub mod loader;
22pub mod plan;
23pub mod recovery;
24pub mod spec;
25pub mod state;
26
27/// Released V1 command-line parser and command runner.
28///
29/// The standalone `type-bridge-migration` binary and the Python wheel entry
30/// point both call this module, keeping one parser, one execution path, and the
31/// same stdout/stderr and exit-code contract.
32#[path = "bin/type_bridge_migration.rs"]
33pub mod legacy_cli;
34
35#[cfg(test)]
36pub(crate) mod testing;
37
38pub use adoption::{
39    LEGACY_ADOPTION_METADATA_V2, LEGACY_IGNORED_SOURCE_METADATA_V1,
40    LEGACY_SIDECAR_ADOPTION_METADATA_V1, LegacyAdoptionHistory, LegacyAdoptionMetadata,
41    LegacyDirectoryAuthority, LegacyDirectoryEntry, LegacyIgnoredSourceMetadata,
42    LegacyMetadataRevision, LegacySchemaEffect, LegacySidecarAdoptionMetadata,
43    MAX_LEGACY_ARTIFACT_BYTES, MAX_LEGACY_DIRECTORY_ENTRIES, MAX_LEGACY_HISTORY_BYTES,
44    VerifiedLegacyHead, load_adoption_history, reconstruct_legacy_head,
45};
46pub use author::map_schema_diff;
47pub use backfill::{BackfillResult, execute_backfill};
48pub use checksum::{
49    ChecksumDrift, check_checksum_drift, checksum_drift_errors, migration_file_checksum,
50};
51pub use error::{MigrationError, Result};
52pub use executor::{MigrationResult, execute_migration, execute_plan, execute_plan_with_run_log};
53pub use graph::{AppliedMigrationRecord, MigrationValidationError, ValidationCode, validate_graph};
54pub use loader::{load_dir, load_dir_checked, load_sidecar};
55pub use plan::{
56    ExecutionPlan, ExecutionStep, MigrationAction, MigrationExecution, OperationKind, StepKind,
57    plan,
58};
59pub use recovery::{
60    CheckedExecutionPlan, CheckedExecutionStep, CheckedMigrationExecution,
61    CheckedMigrationIdentity, ExecutionStepId, PendingProof, RecoveryExecutionResult,
62    RecoveryFuture, RecoveryMigrationResult, RecoveryMigrationStatus, RecoveryPlanStatus,
63    StepExecutionOutcome, StepExecutionResult, StepRecoveryController, StepRecoveryDecision,
64    StepRecoveryEvent, StepRecoveryEventKind, execute_recovery_plan, plan_recovery,
65    prepare_recovery_plan,
66};
67pub use spec::{MigrationDependencySpec, MigrationGraph, MigrationSpec, OperationSpec};
68pub use state::{
69    InMemoryStateStore, LEGACY_CUTOVER_SENTINEL_APP_LABEL, LEGACY_CUTOVER_SENTINEL_APPLIED_AT,
70    LEGACY_CUTOVER_SENTINEL_MIGRATION_ID, LEGACY_CUTOVER_SENTINEL_NAME,
71    LEGACY_WRITER_CUTOVER_MESSAGE, LegacyCutoverSentinelError, LegacyCutoverSentinelExpectation,
72    MigrationExecutorInfo, MigrationRunRecord, MigrationStateSchemaKind, MigrationStateStore,
73    TypeDbStateStore, VerifiedLegacyAppliedPartition, applied_migration_entity_label,
74    collect_executor_info, finished_run_record, is_migration_state_type, migration_state_schema,
75    migration_timestamp_now, require_legacy_writer_open, require_legacy_writer_open_in_transaction,
76    started_run_record,
77};