[Dar-libdar_api] Re: Progress reporting
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Denis C. <dar...@fr...> - 2005-03-30 20:13:39
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Johnathan Burchill wrote:
| On Tuesday 29 March 2005 01:38, Johnathan Burchill wrote:
|
|>Hi Denis,
Hello Johnathan,
I understand your need. To my point of view, this is not really like
user interaction. I would rather transform the statistics structure in a
class. Then an object of that class would be given by the API caller as
argument of each operations, this object is incremented by libdar code
as it is done actually with the statistics structure, but as this would
be now a class and as it is not a returned value but a IN/OUT parameter,
it is know by the caller and can be consulted at will during the libdar
operation (this assumes one thread for the libdar operation another for
consulting the counters).
Why this way? Because this solves the problem for libdar to know when to
send information to the API caller. Instead this is the API caller that
fetches this informations when it needs (it can done by any mean like a
timer, a GUI event and so on). It also avoids having libdar slowed by
this type of report done too often and/or ignored by the caller.
So concretely, we could have:
class statistics
{
public:
void set_treated(const infinint & val);
~ void set_hard_links(const infinint & val);
~ ....
~ infinint get_treated() const;
~ infinint get_hard_links() const;
~ ....
~ void clear();
void get_photo(infinint & treated, infinint & hard_links, ...) const;
private:
infinint treated;
~ infinint hard_links;
~ ...
}
but each set/get method would use a mutex to access the corresponding
variable.
and we could have a typical call to libdar this way:
~ statistics stats;
~ stats.clear();
~ <thread one>
~ op_create(...., stats);
~ // "stats" argument is passed as: statistics & stats
~ <thread two>
~ while(...)
~ {
~ stats.get_photo(....);
~ display_counters_to_user(...);
~ sleep(a_certain_time);
~ }
|>
|
|
| [...]
|
|
Cheers,
Denis.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFCSwf9pC5CI8gYGlIRAtlDAJ9OeJ/kS6RQGckcIFuAlQg1GncJGwCfXZgr
IdwNPLafDYzCNFBYDiYSNl0=
=fmkn
-----END PGP SIGNATURE-----
|