Output port mutability

When the operator logic allows the modification of the submitted tuple by a downstream operator, an output port is defined as mutating.

Use this configuration when the operator does not use the outgoing tuple values after it completes the submission to downstream operators. The SPL compiler ensures that the downstream operator can safely modify the tuple content without forcing a copy.

When the port is set to mutating, the operator logic must use the submit function that takes a non-constant reference to a tuple.

When the port is set to non-mutating, the operator logic can use either the submit call that takes a non-constant reference or the call that takes a constant reference. Even when the submit function is resolved to the version that receives a non-constant reference, the Teracloud® Streams instance casts the tuple to a constant reference before it sends it to downstream operators. As a result, the Teracloud® Streams instance ensures that the tuple value is the same before and after the submit call.

The following figure provides a general guideline for setting output port mutability.


This figure represents a mind map of the variables to configure for output port mutability.