Expand description
Domain newtypes for the replicator crate.
MirrorMaker-2 offset translation juggles three different i64 offsets that
all live in different address spaces:
UpstreamOffset: an offset on the source cluster, as recorded in an offset-sync or checkpoint.DownstreamOffset: the corresponding offset on the target cluster.CommittedOffset: a consumer group’s committed source offset that translation moves to the target.
A call site can transpose these values. For example, it can build an
crate::mm2::OffsetSync as
{ upstream: downstream_val, downstream: upstream_val }, or write the
translate() math as up + (committed - down). Such code compiles cleanly
when every value is a bare i64, and it silently corrupts offset
translation. A separate type for each meaning turns those swaps into compile
errors.
The internal MM2 wire codec (Writer / Reader) still
reads and writes raw i64/i32, so byte-exactness with the JVM MM2 codecs is
preserved: these newtypes wrap only the in-memory domain values and unwrap via
.0 at the codec boundary.
See the newtype guidance in the style guide.
Structs§
- Committed
Offset - A consumer group’s committed source offset that translation moves to the
target. It lives in the same address space as
UpstreamOffset, because both are source-cluster offsets. It is a distinct concept at the translation call site, so it gets its own type. - Downstream
Offset - An offset on the target cluster, paired with an
UpstreamOffsetin an offset-sync or checkpoint (downstreamin the JVM MM2 codecs). - Offset
- The canonical cross-crate
PartitionIndex, as carried in offset-syncs, checkpoints, and replicated records. The MM2 offset newtypes below stay crate-local. They encode source-cluster and target-cluster distinctions that are specific to MirrorMaker-2 and have no meaning outside this crate. A record offset within a topic partition’s log. KIP wire type:int64. - Partition
Index - The canonical cross-crate
PartitionIndex, as carried in offset-syncs, checkpoints, and replicated records. The MM2 offset newtypes below stay crate-local. They encode source-cluster and target-cluster distinctions that are specific to MirrorMaker-2 and have no meaning outside this crate. A partition index within a topic. KIP wire type:int32. - Timestamp
- A record timestamp in epoch milliseconds.
- Upstream
Offset - An offset on the source cluster, as recorded in an offset-sync or
checkpoint (
upstreamin the JVM MM2 codecs).