RecoveryParticipantBoundary constructor

RecoveryParticipantBoundary({
  1. required List<RecoveryBarrierParticipantStatus> participants,
  2. String name = 'recovery_participants',
})

Creates a protocol-neutral participant status boundary.

Implementation

RecoveryParticipantBoundary({
  required List<RecoveryBarrierParticipantStatus> participants,
  super.name = 'recovery_participants',
})  : participantCount = participants.length,
      super(
        definitionName: 'RecoveryParticipantBoundary_'
            'P${participants.length}_${payloadShapesIdentity(participants)}',
      ) {
  if (participants.isEmpty) {
    throw ArgumentError.value(
      participants,
      'participants',
      'Must not be empty.',
    );
  }
  this.participants = [
    for (var index = 0; index < participants.length; index++)
      addTypedInput('participant$index', participants[index]),
  ];
  addOutput('participantReady', width: participantCount);
  addOutput('participantDone', width: participantCount);
  addOutput('participantFailed', width: participantCount);
  participantReady <=
      [for (final participant in this.participants) participant.ready]
          .rconcat();
  participantDone <=
      [for (final participant in this.participants) participant.done]
          .rconcat();
  participantFailed <=
      [for (final participant in this.participants) participant.failed]
          .rconcat();
}