From eaf74cbebd3b90bd4d435a1dff0d5eeac993aa01 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 4 Apr 2023 13:41:23 -0400 Subject: [PATCH] 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 --- rbd/rbd_sparsify.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rbd/rbd_sparsify.go b/rbd/rbd_sparsify.go index d1cb812..7ed6082 100644 --- a/rbd/rbd_sparsify.go +++ b/rbd/rbd_sparsify.go @@ -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()