Progress reporting

Johnathan Burchill <[email protected]> Tue, 29 Mar 2005 01:38:25 -0700
Newsgroups gmane.comp.sysutils.backup.dar.libdar
Message-ID <[email protected]>
Hi Denis,

I'm interested in being able to get progress on libdar operations while they 
happen. Something like a visual representation of the libdar::statistics 
structure as the counters are being incremented would be helpful.

Since libdar already provides this structure at the end of the operation, it 
seems it would be possible to store it in the user_interaction abstract 
class, giving the user access to it at will, perhaps via internal accessor 
methods involving mutexes. One could argue that providing the user with 
operation stats is a form of user interaction anyway. So you could then get 
rid of the separate "libdar::statistics" parameter in each archive operation 
method.

Another way could be to change 

void libdar::user_interaction::warning( const std::string & message )

to 

void libdar::user_interaction::warning( const libdar::message & info )

where info is 

struct info
{
    std::string message;
    bool progress_update;
    libdar::statistics stats;
}

(or change it to void libdar::user_interaction::warning( const std::string & 
message, const libdar::statistics & stats ) )

Then I could do the following in KDar:

KDarInteraction::warning( const libdar::info info)
{
    if ( info.progress_update )
    {
        m_inodesProcessed = info.stats.treated;
        progressBar->update( (int) (m_inodesProcessed*100/totalInodes) );
    }
}

where totalInodes is computed by running the creation operation in dry-run 
mode beforehand or concurrently as a separate, but much faster, thread (to be 
done by the client).

What do you think?

Cheers,
JB

-- 
Johnathan K. Burchill, Ph.D.
[email protected]
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)

iD8DBQBCSRQHrXMSOtiWrO4RAkhTAJ0U8ayMrst9N6/gayETg6zMvNrFLQCfU8mo
PwylqIgAklItqi+eyn2Fqk4=
=Lr2g
-----END PGP SIGNATURE-----