src/transfer/Migrate.bend checks
raw source on the hub · import mylsm-lsm-store@0.6.0.2/src/transfer/Migrate.bend as Migrate
8 imports
import Base import ../ByteMemTable.bend as ByteMemTable import ../MemTable.bend as MemTable import ../StorageBytes.bend as StorageBytes import ../Wal.bend as Wal import ../coordinator/QueuePolicy.bend as QueuePolicy import ./FormatInspect.bend as FormatInspect import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
Types
type SourceValidation source · line 11 · raw
Data
Reports the result of verifying all legacy WAL and SST files.
LegacyFilesVerified@entries:Nat -> @encoded_bytes:Nat -> SourceValidation
LegacyFilesRejectedSourceValidation
SourceNotCheckedSourceValidation
type Rejection source · line 17 · raw
Data
Classifies safe migration preflight failures.
UnsupportedSourceRejection
InvalidManifestRejection
SourceFilesInvalidRejection
SourceFilesNotVerifiedRejection
DestinationExistsRejection
ResourceLimitRejection
type Decision source · line 26 · raw
Data
Admits a fully verified source or rejects it before destination mutation.
MigrateReady@entries:Nat -> @encoded_bytes:Nat -> Decision
MigrateRejected@reason:Rejection -> Decision
type Publication source · line 31 · raw
Data
Tracks the migration stages that guard atomic destination publication.
SourceValidatedPublication
DestinationStagedPublication
RecordsCopiedPublication
DestinationValidatedPublication
PublishedPublication
AbortedPublication
type PublicationDecision source · line 40 · raw
Data
Reports an allowed stage transition or a rejected transition.
PublicationAdvanced@state:Publication -> PublicationDecision
PublicationRejectedPublicationDecision
type LegacyApplyState source · line 45 · raw
Type
Carries legacy record conversion across bounded state-machine steps.
LegacyApplyNeed@entries:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @table:0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table -> LegacyApplyState
LegacyApplyConverted@tail:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @table:0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table -> @result:Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> LegacyApplyState
Definitions
def legacy.string.clone.go source · line 50 · raw
@value:String -> @left:String -> @right:String -> Pair(String, String)
def legacy.string.clone source · line 56 · raw
@value:String -> Pair(String, String)
def canonical.entries source · line 59 · raw
@table:0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table -> List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>
def legacy.value.bytes.result source · line 62 · raw
@result:Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Result<&1, &1, Pair(U32, String), Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>>
def legacy.value.bytes source · line 69 · raw
@value:Maybe<&2, String> -> Result<&1, &1, Pair(U32, String), Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>>
def legacy.entry.bytes.value source · line 76 · raw
@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @result:Result<&1, &1, Pair(U32, String), Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>> -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>
def legacy.entry.bytes.key source · line 84 · raw
@value:Maybe<&2, String> -> @pair:Pair(String, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>
def legacy.entry.bytes.start source · line 93 · raw
@value:Maybe<&2, String> -> @pair:Pair(String, String) -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>
def legacy.entry.bytes source · line 102 · raw
@entry:0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>
def legacy.apply.loop source · line 109 · raw
@fuel:Nat -> @state:LegacyApplyState -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>
def legacy.entries.measure.go source · line 139 · raw
@entries:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @reversed:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @count:Nat -> Pair(List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry>, Nat)
def legacy.entries.measure source · line 149 · raw
@entries:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> Pair(List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry>, Nat)
def legacy.apply.measured source · line 154 · raw
@pair:Pair(List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry>, Nat) -> @table:0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>
def legacy.apply.chronological source · line 163 · raw
@entries:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @table:0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>
def legacy.batch.entries source · line 169 · raw
@mutations:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Mut> -> List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry>
def legacy.mutations.count source · line 179 · raw
@mutations:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Mut> -> Nat
def legacy.batches.mutation.count source · line 184 · raw
@batches:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Batch> -> Nat
def legacy.source.mutation.count source · line 191 · raw
@sst_entries:Nat -> @wal_batches:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Batch> -> Nat
def legacy.batches.entries source · line 197 · raw
@batches:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Batch> -> List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry>
def legacy.sources.chronological source · line 204 · raw
@sst_newest_first:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @wal_batches:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Batch> -> List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry>
def legacy.snapshot.table source · line 212 · raw
@sst_newest_first:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @wal_batches:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Batch> -> Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>
def legacy.snapshot.canonicalize source · line 220 · raw
@result:Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table> -> Result<&1, &1, Pair(U32, String), List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>>
def legacy.snapshot.entries source · line 227 · raw
@sst_newest_first:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/MemTable.Entry> -> @wal_batches:List<&2, 0x7586b743ff7fd05e412d5115859629b6/src/Wal.Batch> -> Result<&1, &1, Pair(U32, String), List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>>
def begin source · line 235 · raw
@decision:Decision -> PublicationDecision
Begins publication only for a source admitted by the migration plan.
def stage_destination source · line 241 · raw
@state:Publication -> PublicationDecision
Stages a sibling destination only after source validation.
def records_copied source · line 247 · raw
@state:Publication -> PublicationDecision
Marks the copy complete only for an initialized staging destination.
def destination_validated source · line 253 · raw
@state:Publication -> @counts:Pair(Nat, Nat) -> @checks:Pair(Bool, Bool) -> PublicationDecision
Marks the staged database verified only when count, digest, and order agree.
def publish source · line 271 · raw
@state:Publication -> PublicationDecision
Allows final publication only after destination verification.
def abort source · line 277 · raw
@state:Publication -> PublicationDecision
Aborts an unpublished migration without retracting a published destination.
def source.supported source · line 284 · raw
@identity:0x7586b743ff7fd05e412d5115859629b6/src/transfer/FormatInspect.Identity -> Bool
Accepts only the durable API and storage identities promised for migration.
def gate.destination.measured source · line 291 · raw
@max_entries:Nat -> @max_encoded_bytes:Nat -> @destination_missing:Bool -> @entry_counts:Pair(Nat, Nat) -> @byte_counts:Pair(Nat, Nat) -> Decision
Applies count and byte limits after duplicating the affine byte count.
def gate.destination source · line 311 · raw
@validation:SourceValidation -> @destination_missing:Bool -> @max_entries:Nat -> @max_encoded_bytes:Nat -> Decision
Checks verified record and byte counts against configured migration limits.
def gate.source source · line 328 · raw
@validation:SourceValidation -> @destination_missing:Bool -> @max_entries:Nat -> @max_encoded_bytes:Nat -> @supported:Bool -> Decision
Applies the source compatibility check before destination admission.
def gate.manifest source · line 341 · raw
@validation:SourceValidation -> @destination_missing:Bool -> @max_entries:Nat -> @max_encoded_bytes:Nat -> @supported:Bool -> @integrity:0x7586b743ff7fd05e412d5115859629b6/src/transfer/FormatInspect.Integrity -> Decision
Requires a valid manifest before considering the legacy file verification.
def plan source · line 359 · raw
@inspection:0x7586b743ff7fd05e412d5115859629b6/src/transfer/FormatInspect.Inspection -> @validation:SourceValidation -> @destination_missing:Bool -> @max_entries:Nat -> @max_encoded_bytes:Nat -> Decision
Chooses compatibility, validation, destination, and resource preconditions.