class D4::WriteControl

Overview

Coordinates progress reporting and cooperative cancellation for D4 writes.

A control may be cancelled from another fiber or thread. Callbacks run in the fiber performing the write and should return quickly.

Defined in:

d4/write_control.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(on_progress : Proc(WriteProgress, Nil) | Nil = nil) #

[View source]
def self.new(&on_progress : WriteProgress -> Nil) #

[View source]

Instance Method Detail

def cancel : Nil #

Requests cancellation. The operation stops at its next checkpoint.


[View source]
def cancelled? : Bool #

[View source]
def check! : Nil #

Raises CancelledError when cancellation has been requested.


[View source]
def update(progress : WriteProgress) : Nil #

Emits a progress snapshot after checking for cancellation.


[View source]