pub struct RecordCoordinate { /* private fields */ }Expand description
Re-exported: the durable address WeirClient::push_tracked returns for an
accepted record. Lives in weir-core because both ends of the socket build
it from the same bytes.
Where one accepted record lives in the write-ahead buffer, plus the id the
downstream sees for it.
§What it is
segment— the record’s segment address,<shard-dir>/<file-name>, e.g.shard_00/seg_00000001.wab.sealed. Treat it as an opaque, stable string, not a filesystem path: it names the segment the drain will read the record from, which is a predicted name at ack time (the segment is still open).index— the record’s 1-based ordinal within that segment.record_id—sha256(segment ++ index ++ payload)with length framing. Byte-identical to theIdempotency-Keythe HTTP sink sends for this record, and to the id the S3 sink names objects with.
§What it is not
A coordinate is a buffer address, not a per-producer sequence number.
Records from other producers interleave, so one producer’s indices have
holes; (segment, index) gives a total order per shard and lets a producer
recognise a record it has already sent, but it is not a gap-free sequence.
A coordinate is also not a durability upgrade. A Buffered push gets a
coordinate as readily as a Durable one; the tier still decides whether the
bytes survive power loss.
Implementations§
Source§impl RecordCoordinate
impl RecordCoordinate
Sourcepub fn new(
segment: String,
index: u64,
record_id: [u8; 32],
) -> Result<RecordCoordinate, CoordinateError>
pub fn new( segment: String, index: u64, record_id: [u8; 32], ) -> Result<RecordCoordinate, CoordinateError>
Builds a coordinate, rejecting a segment name that could not be encoded
within MAX_SEGMENT_NAME_LEN.
Fallible rather than truncating: a shortened segment name still looks
like an address and would send a producer to the wrong record — silently.
The daemon treats an Err here as an internal error and nacks.
Sourcepub fn record_id_hex(&self) -> String
pub fn record_id_hex(&self) -> String
The record id as 64 lowercase hex characters, no prefix — the form that
matches weir_sink_sdk::RecordId::to_hex and the sink’s
Idempotency-Key: sha256:<hex> header.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Serialises to the AckTracked payload layout.
[0] coordinate_version
[1..9] index u64 LE
[9..41] record_id 32 bytes
[41..43] segment_len u16 LE
[43..] segment UTF-8Sourcepub fn decode(buf: &[u8]) -> Result<RecordCoordinate, CoordinateError>
pub fn decode(buf: &[u8]) -> Result<RecordCoordinate, CoordinateError>
Parses an AckTracked payload.
The buffer must be exactly one coordinate — trailing bytes are rejected
rather than ignored, matching Envelope::decode:
a payload longer than it declares means the sender and receiver disagree
about the layout, and quietly using the prefix is how a disagreement
becomes a wrong address.
Trait Implementations§
Source§impl Clone for RecordCoordinate
impl Clone for RecordCoordinate
Source§fn clone(&self) -> RecordCoordinate
fn clone(&self) -> RecordCoordinate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more