Expand description
§crdt-migrate
Transparent schema migrations for crdt-kit.
When your data schema evolves between versions, crdt-migrate ensures that
persisted data is automatically and transparently migrated — no downtime,
no manual intervention, no data loss.
§How It Works
- Every serialized CRDT is wrapped in a version envelope (3-byte header).
- When data is loaded, the envelope version is compared to the current version.
- If they differ, a chain of migration steps runs automatically.
- Optionally, the migrated data is written back to storage.
§Key Concepts
- Lazy migration: Data is migrated on read, not eagerly on startup.
- Deterministic: Two devices migrating the same data produce identical results.
- Linear chain: Migrations run v1→v2→v3→…→current, never skipping steps.
- Compiled in: All migrations are embedded in the binary at compile time.
Structs§
- Migration
Config - Configuration for the migration engine.
- Migration
Engine - The migration engine that runs a chain of migration steps.
- Versioned
Envelope - A version envelope wrapping serialized CRDT data.
Enums§
- Crdt
Type - Identifies the type of CRDT stored in the envelope.
- Migration
Error - Error during migration.
Constants§
- ENVELOPE_
HEADER_ SIZE - Size of the version envelope header in bytes.
- MAGIC_
BYTE - Magic byte identifying crdt-kit serialized data.
Traits§
- Migration
Step - A single migration step that transforms data from one version to the next.
- Schema
- Trait for types with a versioned schema.
Attribute Macros§
- crdt_
schema - Attribute macro that generates schema + versioning impls for a struct.
- migration
- Attribute macro that wraps a migration function into a
MigrationStep.