View Source Skitter.BIS.KeyedState (Skitter v0.7.1)

Strategy for stateful operations that can partition their state by key.

This strategy can be used for stateful operations with a keyed state. It expects an operation to provided a key and a react callback. When the operation receives data, the key callback will be called to determine the key of the incoming data, afterwards, the value will be sent to a worker maintaining the state for key. This worker might live on another cluster node. Finally, this worker will call the react callback to update the state of the key.

Operation Properties

  • in ports: A single in port is required.
  • out ports: This strategy places no limitations on the out ports of the operation.
  • callbacks:
    • key (required): Called for each incoming data element. Can not access operation state.
    • react (required): Called for each incoming data element.
    • conf (optional): Called to create a configuration for the operation.
    • initial_state (optional): Called to create the initial state for a key when it occurs for the first time. If it is not provided, the state defaults to nil.