TWorkflowCheckpoint
Native Pascal, workflow preparation
Description
TWorkflowCheckpoint is the parameterless method callback that workflow stream helpers invoke as a cancellation and progress checkpoint. PLCopyWorkflowStream calls it before each read and each write, and the bounded output stream used for workflow delivery calls it before reads, writes, seeks and size changes, so a long copy can be stopped between chunks.
The callback observes state through its owning object, for example TPLWorkflowContext.CheckIO; to stop the operation it raises an exception, conventionally EWorkflowCancelled, which propagates to the caller of the stream helper.
Syntax
Delphi
TWorkflowCheckpoint = Procedure Of Object;Parameters
| (none) | The callback takes no arguments; cancellation is signalled by raising an exception |
|---|
Return values
| (none) | A procedure returns no value; returning normally continues the operation |
|---|
Remarks
The parameter is optional wherever it appears, and Nil disables checkpointing.
Checkpoints run on the thread that performs the copy, roughly once per 64 KiB chunk and around partial writes, so keep them short and free of blocking waits.
After a checkpoint raises, the destination contains the bytes written so far and the source position is restored only when preservation was requested; stage output before publishing it.
A checkpoint must not call back into the same source or destination stream.