MCPcopy Create free account
hub / github.com/Shopify/ghostferry / NumericPosition

Method NumericPosition

pagination_key.go:142–153  ·  view source on GitHub ↗

NumericPosition calculates a rough float position for progress tracking. Note: This method only uses the first 8 bytes of the binary key for progress calculation. This works well for timestamp-based keys like UUID v7 (where the first 48 bits are a timestamp), but progress may appear frozen when pro

()

Source from the content-addressed store, hash-verified

140//
141// The core pagination algorithm (using Compare()) is unaffected and works correctly with any binary data.
142func (k BinaryKey) NumericPosition() float64 {
143 if len(k.Value) == 0 {
144 return 0.0
145 }
146
147 // Take up to the first 8 bytes to form a uint64 for estimation
148 var buf [8]byte
149 copy(buf[:], k.Value)
150
151 val := binary.BigEndian.Uint64(buf[:])
152 return float64(val)
153}
154
155func (k BinaryKey) String() string {
156 return hex.EncodeToString(k.Value)

Calls

no outgoing calls