MIL << "Repository " << info.alias() << " is cached" << endl;
data::RecordId id = store.lookupRepository(info.alias());
-
+
+ CombinedProgressData subprogrcv(progress);
+
repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
- opts.readingResolvablesProgress = progressrcv;
+ opts.readingResolvablesProgress = subprogrcv;
repo::cached::RepoImpl::Ptr repoimpl =
new repo::cached::RepoImpl( opts );
\r
#include <string>\r
#include "zypp/base/Exception.h"\r
+#include "zypp/ProgressData.h"\r
#include <boost/utility.hpp>\r
\r
#define SQLITE3X_THROW zypp::ZYPP_THROW\r
friend class sqlite3_command;\r
friend class database_error;\r
struct sqlite3 *db;\r
+ zypp::ProgressData _ticks;\r
public:\r
sqlite3_connection();\r
sqlite3_connection(const char *db);\r
sqlite3_connection(const wchar_t *db);\r
\r
- void setprogresshandler( int, int(*)(void *), void* );\r
+ void setprogresshandler( int,\r
+ const zypp::ProgressData::ReceiverFnc & );\r
\r
~sqlite3_connection();\r
\r
std::string executeblob(const wchar_t *sql);\r
std::string executeblob(const std::string &sql);\r
std::string executeblob(const std::wstring &sql);\r
+ \r
+ int _progress_handler_accessor(void* ptr);\r
};\r
\r
class sqlite3_command;\r
#include <sqlite3.h>\r
#include "sqlite3x.hpp"\r
\r
+static int global_progress_handler(void* ptr)\r
+{\r
+ //RepoImpl *r = dynamic_cast<RepoImpl *>(ptr);\r
+ sqlite3x::sqlite3_connection *r = (sqlite3x::sqlite3_connection *)(ptr);\r
+ if ( r )\r
+ return r->_progress_handler_accessor(ptr);\r
+ return 0;\r
+}\r
+\r
namespace sqlite3x\r
{\r
\r
+int sqlite3_connection::_progress_handler_accessor(void* ptr)\r
+{\r
+ if ( _ticks.tick() )\r
+ return 0;\r
+ return 1;\r
+}\r
+ \r
sqlite3_connection::sqlite3_connection() : db(NULL)\r
{}\r
\r
if (this->db) sqlite3_close(this->db);\r
}\r
\r
-void sqlite3_connection::setprogresshandler( int n, int(*fnc)(void*), void* ptr )\r
+void sqlite3_connection::setprogresshandler( int n,\r
+ const zypp::ProgressData::ReceiverFnc &fnc )\r
{\r
- sqlite3_progress_handler(db, n, fnc, ptr);\r
+ _ticks.sendTo(fnc);\r
+ if ( fnc )\r
+ sqlite3_progress_handler(db, n, global_progress_handler, (void*)this);\r
+ else\r
+ sqlite3_progress_handler(db, n, NULL, (void*)this);\r
}\r
\r
void sqlite3_connection::open(const char *db)\r
MIL << "Destroying repo '" << info().alias() << "'" << endl;
}
-static int global_progress_handler(void* ptr)
-{
- //RepoImpl *r = dynamic_cast<RepoImpl *>(ptr);
- RepoImpl *r = (RepoImpl *)(ptr);
- if ( r )
- return r->progress_handler(ptr);
- return 0;
-}
-
void read_capabilities( sqlite3_connection &con,
map<data::RecordId, NVRAD> &nvras,
ProgressData &progress );
-
-int RepoImpl::progress_handler(void* ptr)
-{
- if ( _ticks.tick() )
- return 0;
- return 1;
-}
-
void RepoImpl::createResolvables()
{
_ticks = ProgressData();
_ticks.sendTo(_options.readingResolvablesProgress);
_ticks.name(str::form(_( "Reading '%s' repository cache"), info().alias().c_str()));
-
+ CombinedProgressData subprogrcv(_ticks);
+
debug::Measure m("create resolvables");
CapFactory capfactory;
try
{
sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str());
- con.setprogresshandler(100, global_progress_handler, (void*)this);
+ con.setprogresshandler(100, subprogrcv);
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
}
}
con.executenonquery("COMMIT;");
- con.setprogresshandler(00, NULL, NULL);
+ con.setprogresshandler(00, ProgressData::ReceiverFnc());
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;
_ticks = ProgressData();
_ticks.sendTo(_options.readingPatchDeltasProgress );
_ticks.name(str::form(_( "Reading patch and delta rpms from '%s' repository cache"), info().alias().c_str()));
-
+ CombinedProgressData subprogrcv(_ticks);
try
{
sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str());
_patchRpms.push_back(patch);
}
- con.setprogresshandler(0, NULL, NULL);
+ con.setprogresshandler(0, ProgressData::ReceiverFnc());
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;
RepoOptions _options;
ProgressData _ticks;
public:
- int progress_handler(void*);
};
///////////////////////////////////////////////////////////////////