restore method
override
Restores this participant from a validated image.
Implementation
@override
void restore({
required int transactionId,
required Object image,
required bool quiescent,
}) {
final compositeImage = image as CompositeStateSnapshotImage;
if (compositeImage.records.length != children.length) {
throw ArgumentError('Composite snapshot child count does not match.');
}
final recordsByPath = {
for (final record in compositeImage.records) record.path: record,
};
for (var index = 0; index < children.length; index++) {
final child = children[index];
final record = recordsByPath[child.path];
if (record == null ||
record.schemaKind != child.schemaKind ||
record.schemaVersion != child.schemaVersion ||
record.configurationIdentity != child.configurationIdentity) {
throw ArgumentError(
'Composite snapshot manifest does not match ${child.path}.');
}
child.capabilities.validateRequest(
StateTransactionOperation.restore,
quiescent: quiescent,
);
child.restore(
transactionId: transactionId + index,
image: record.image,
quiescent: quiescent,
);
}
}