rbd: document SparsifyWithProgress callback's arguments

As discussed in #851, we wanted to fully document the arguments the
callback function is expected to be called with.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2023-04-04 13:41:23 -04:00 committed by mergify[bot]
parent 3d986f2bd3
commit eaf74cbebd
1 changed files with 8 additions and 2 deletions

View File

@ -27,8 +27,14 @@ import (
// SparsifyCallback defines the function signature needed for the
// SparsifyWithProgress callback.
//
// This callback will be called by SparsifyWithProgress when it
// wishes to report progress on sparse.
// This callback will be called by SparsifyWithProgress when it wishes to
// report progress on sparse. The callback function will be called with the
// first argument containing the current offset within the image being made
// sparse and the second argument containing the total size of the image. The
// third argument is an opaque value that is passed to the SparsifyWithProgress
// function's data argument and every call to the callback will receive the
// same object. The sparsify operation will be aborted if the progress
// callback returns a non-zero value.
type SparsifyCallback func(uint64, uint64, interface{}) int
var sparsifyCallbacks = callbacks.New()