Class PubSubMessageHeaders
- All Implemented Interfaces:
Measurable,Iterable<PubSubMessageHeader>
- Direct Known Subclasses:
EmptyPubSubMessageHeaders
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(PubSubMessageHeader header) intbooleanisEmpty()iterator()static PubSubMessageHeadersReturns aPubSubMessageHeaderswithout theVENICE_TRANSPORT_PROTOCOL_HEADER(a.k.a.static PubSubMessageHeadersAlways-copy variant ofstripProtocolSchemaHeader(com.linkedin.venice.pubsub.api.PubSubMessageHeaders).toList()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EXECUTION_ID_KEY
- See Also:
-
VENICE_TRANSPORT_PROTOCOL_HEADER
- See Also:
-
VENICE_LEADER_COMPLETION_STATE_HEADER
Header to denote whether the leader is completed or not- See Also:
-
VENICE_VIEW_PARTITIONS_MAP_HEADER
Header to provide the desired view partition mapping for the given message. Example usage: 1. A VPJ containing large messages write chunks with the header {"view1":[0], "view2":[1, 2]}. Partition leaders during NR pass-through in remote fabrics can forward chunks to their destination view partition(s) without any further processing. In the example, this chunk should be sent to view1's partition 0 and view2's partitions 1 & 2.- See Also:
-
-
Constructor Details
-
PubSubMessageHeaders
public PubSubMessageHeaders()
-
-
Method Details
-
add
-
add
-
remove
-
get
-
toList
- Returns:
- the headers as a List
. Mutating this list will not affect the PubSubMessageHeaders. If no headers are present an empty list is returned.
-
isEmpty
public boolean isEmpty() -
stripProtocolSchemaHeader
Returns aPubSubMessageHeaderswithout theVENICE_TRANSPORT_PROTOCOL_HEADER(a.k.a.vtp). Thevtpvalue is the entire ~16 KB Avro JSON forKafkaMessageEnvelope; once the value envelope has been deserialized it is dead weight and pinning it per queued record has been observed to cost upwards of 10 GB on the DaVinci ingestion buffer queue during back-pressure.Best-effort: when
vtpis absent the input is returned as-is (no allocation). When present, the helper attempts an in-placeremove— allocation-free for the production hot path where callers construct fresh mutable headers per record. Ifremove()throws anyRuntimeException(e.g.UnsupportedOperationExceptionfrom an immutable variant), the helper falls back to building a new headers object withoutvtp. Never throws — the strip is on the deserialization hot path, where an escaping exception would kill the partition's ingestion thread.Use
stripProtocolSchemaHeaderCopy(com.linkedin.venice.pubsub.api.PubSubMessageHeaders)instead when the caller's headers reference is shared across reads (e.g. an in-memory broker that re-serves the same message), since silent in-place mutation would corrupt subsequent observers. -
stripProtocolSchemaHeaderCopy
Always-copy variant ofstripProtocolSchemaHeader(com.linkedin.venice.pubsub.api.PubSubMessageHeaders). Returns the input unchanged whenvtpis absent (no allocation); otherwise returns a freshPubSubMessageHeadersomittingvtpand leaves the input untouched. Use this from call sites where the headers reference is shared across reads. -
getHeapSize
public int getHeapSize()- Specified by:
getHeapSizein interfaceMeasurable
-
iterator
- Specified by:
iteratorin interfaceIterable<PubSubMessageHeader>
-