Input port mutability
When an input port is configured as mutating, the operator logic intends to modify the tuples that arrive on that port.
The Teracloud® Streams instance ensures that tuples delivered to this input port can be safely mutated.
When an input port is defined as mutating, the operator code receives
a non-constant reference to a tuple. The tuples for that input port
are processed by the function with signature void process(Tuple
& tuple,uint32_t port)
, which means that the operator
code can modify the content of the incoming tuple.
When an input port is configured as non-mutating, the operator
code receives a constant reference to a tuple. The tuples for the
input port are processed by the function with signature void
process(const Tuple & tuple,uint32_t port)
. Any attempt
to modify a constant reference is forbidden by the C++ compiler.
The following figure provides a general guideline for setting input port mutability.
