Commit Graph

50 Commits

Author SHA1 Message Date
Ettore Di Giacinto a762d43bdc Revert "inject: fix store of content with utf-8 chars" 2018-08-11 16:13:54 +02:00
Ettore Di Giacinto 686f7e3ebc Merge pull request #50 from Enlik/equo-mark
[solo.commands.mark] new command
2018-08-04 23:00:31 +02:00
Geaaru b9580f8244 inject: fix store of content with utf-8 chars 2018-08-04 21:09:42 +02:00
Sławomir Nizio 70f1719138 [solo.commands.mark] new command 2018-07-31 08:58:31 +02:00
Fabio Erculiani 49c970974d [entropy.db.sql] fix typo in SQL in resolveNeeded 2014-10-17 11:29:18 +01:00
Fabio Erculiani 7b2810c054 [entropy.db] rewrite needed libraries SQL schema, keep compat. 2014-09-30 09:10:11 +01:00
Fabio Erculiani d2e181bcb4 [entropy.db] add removeConflicts() and insertConflicts() 2014-05-31 15:25:43 +01:00
Fabio Erculiani 3ebba8b14f [entropy.db.sql] fix typo in SQL query, s/tag/versiontag/ 2014-01-04 11:15:27 +01:00
Fabio Erculiani 338b3f6cc5 [entropy.db] expose and use the currently set cache policy 2014-01-02 23:00:00 +01:00
Fabio Erculiani 4edaf614f4 [entropy.db.sql] in global context, the current thread is always MainThread 2013-12-31 17:38:57 +01:00
Fabio Erculiani 956b31d05e [entropy.db.sql] add overridable isMainThread method
a MainThread may be a "liquid" concept. A dedicated worker thread
may be considered a "MainThread" from the point of view of EntropySQLRepository.

_start_cleanup_monitor checks whether the calling thread is the MainThread
in order to determine if a cleanup thread should be started joining
the current thread. The problem with this approach is that if our
worker thread is a long lasting thread, we will end up with hundreds
of cleanup monitor threads waiting for the worker thread to terminate.
This will never happen though.

We can now reimplement isMainThread in order to tell the internal
function not to start the cleanup monitor thread also for arbitrary
threads (like the worker thread in RigoDaemon).
2013-12-31 17:24:24 +01:00
Fabio Erculiani ae8b91ac0c [entropy.*] s:occured:occurred: 2013-12-13 10:57:19 +01:00
Fabio Erculiani 023e8e1b72 [entropy.db] EntropyBaseRepository: make possible to permanently enable direct mode 2013-12-12 10:21:27 +01:00
Fabio Erculiani 0243ed70b1 [entropy.db.sql] rewrite type checking in insertDependencies()
metadata could be of list type (and not just tuple) in case of
data coming from websrv.
2013-12-11 22:42:14 +01:00
Fabio Erculiani c199b6839f [entropy.db] remove support for deprecated provide metadata 2013-11-30 12:02:07 +01:00
Fabio Erculiani a54f5b36bc [entropy.db] drop 'dependencies' metadata support completely 2013-11-30 11:51:06 +01:00
Fabio Erculiani e406a4edaa [entropy.*] create new dependencies metadata "pkg_dependencies"
The old "dependencies" metadata is deprecated. It was found that
the generated metadata might get corrupted by colliding atom strings.
The new implementation avoids collisions completely and is more
efficient.
2013-11-29 19:15:44 +01:00
Fabio Erculiani e7c482ac21 [entropy.db] add atom field to preserved_libs metadata 2013-11-27 12:30:09 +01:00
Fabio Erculiani 96ef5868f4 [entropy.db] initial repository database support for preserved libraries 2013-11-20 17:09:48 +01:00
Fabio Erculiani d089978b74 Revert "[entropy.db.cache] add timed expiration support for cached elements"
This reverts commit 8b7c48c2d9.
2013-11-20 11:42:51 +01:00
Fabio Erculiani 8b7c48c2d9 [entropy.db.cache] add timed expiration support for cached elements 2013-11-20 11:25:02 +01:00
Fabio Erculiani 7eb0687ba9 [entropy.db] make listAllDependencies() public 2013-11-19 14:48:20 +01:00
Fabio Erculiani 016573701c [entropy.db.sql] fix retrieveDependencies() usage of resolve_conditional_deps 2013-11-19 11:18:05 +01:00
Fabio Erculiani 08e4b487bf [entropy.db] API change, handlePackage(forcedRevision -> revision) 2013-11-18 15:09:28 +01:00
Fabio Erculiani b5d7dfeb90 [entropy.db] drop strings= keyword arg from checksum()
This is no longer in use.
2013-08-10 11:33:02 +02:00
Fabio Erculiani db8cc4abfb [entropy.db] EntropyRepository.checksum: add "include_dependencies" argument
include_dependencies can be used to include dependencies information
into the computed checksum.
2013-07-24 16:21:25 +02:00
Fabio Erculiani b8b958604f [entropy.db.sql] retrieveTreeUpdatesActions, listAllTreeUpdatesActions: order results by date 2013-06-10 10:39:47 +02:00
Fabio Erculiani 1cd7838385 [entropy.db.sql] definitely fix the cursor object wrapping 2013-03-23 11:38:39 +00:00
Fabio Erculiani af55cef3be [entropy.db.sql] wrap the whole tuple() and frozenset() generation 2013-03-19 15:02:23 +00:00
Fabio Erculiani bc9e6e2146 [entropy.db.sql] wrap _cur2tuple and _cur2frozenset functions using SQLCursorWrapper 2013-03-19 14:57:03 +00:00
Fabio Erculiani 9eb56dbc14 [entropy.const] drop several etpConst constants, replace with more OO vars
etpConst['clientdbid'] is kept for backward compatibility, but will be removed soon
While etpConst['serverdbid'] and etpConst['clientserverrepoid'] are gone.
2013-02-20 00:56:52 +00:00
Fabio Erculiani 952c361c5a [entropy.db] add listAllSystemPackageIds() method 2013-02-09 13:53:11 +00:00
Fabio Erculiani 28ce290999 [entropy.db] add listAllInjectedPackageIds 2013-02-09 10:50:11 +00:00
Fabio Erculiani db91ce20b4 [entropy.db] catch idiotic "no transaction is active" sqlite3 OperationalError 2012-11-25 18:33:21 +01:00
Fabio Erculiani 4da0c49b07 [entropy.db.sql] move methods used by _addPackage() into class 2012-08-22 17:41:01 +02:00
Fabio Erculiani 206fe49203 [entropy.db.sql] add __next__() to iterators, make Python3 happy 2012-08-17 21:40:55 +02:00
Fabio Erculiani a37d7ca195 [entropy.db.sqlite] move _addPackage() to entropy.db.sql 2012-08-16 21:35:45 +02:00
Fabio Erculiani 5a49098515 [entropy.db] move _getLiveCacheKey and __hash__ to entropy.db.sql 2012-08-16 21:30:51 +02:00
Fabio Erculiani a0394ba9a5 [entropy.db.sql] introduce _UPDATE_OR_REPLACE and move remaining SQL to entropy.db.sql 2012-08-16 21:20:46 +02:00
Fabio Erculiani 1b10177640 [entropy.db.sql] major cursor and connection pooling rework
The original idea was to avoid doing cursor and connection resources
cleanup (left by old and dead threads) synchronously every time
_connection() and/or _cursor() is accessed. This strategy also had
a huge drawback: with no activity on the object, resources were
left hanging there forever.

This commit introduces a better strategy for transparent and automatic
cleanup of resources belonging to terminated threads: every time a new
thread_id arrives at _cursor() or _connection(), a new daemon thread
starts and synchronizes with the caller through a simple Thread.join()
(because it's a daemon thread, we can join() daemon threads as well,
even if this is not really compliant with the specs, but it seems to work
just fine in Python).
When the caller thread is joined, it is possible to start the resources
cleanup procedure, carefully taking into account that thread_ids are
recycled and thus there might be clashing with newly created threads.

This helped a design issue to emerge from the sand (like a zombie
at the seaside): it is impossible to cleanup resources left by the
MainThread because this thread never ends living, and if it dies,
everything dies, obviously. So, the first implementation of this new
strategy was NOT touching the MainThread resources but then, the old
behaviour was to kill them as well on EntropyRepository.close().
So, the final version of this patch kept the old buggy behaviour of
touching MainThread stuff (nein, nein, nein, nein would Hitler say).
However, a new keyword argument "safe" has been added to the close()
method so it is possible to start migrating code to the dark side of the
power.

This means nothing really changed for API consumers yet, just entropy.db.sql
code being more efficient (no weird for loops and synchronous crap)
and actually faster (multi-threading ftw).
2012-08-15 20:59:45 +02:00
Fabio Erculiani 8d00d5beec [entropy.db.sql] make custom iterators work across multiple iterations 2012-08-14 10:26:22 +02:00
Fabio Erculiani 8c0c0dc10a [entropy.db.sql] _insertLicenses: tolerate unique constraint violations
The licensename column is declared as UNIQUE, multiple threads inserting
rows can cause unique constraint violations. Considering the nature of
the data, using "INSERT OR REPLACE" can be considered safe and actually
wanted.
2012-08-12 22:11:49 +02:00
Fabio Erculiani e05b649f98 [entropy.db] remove do_cleanup argument from removePackage() 2012-08-12 16:15:23 +02:00
Fabio Erculiani 9d665e050c [entropy.db] remove do_commit argument from methods 2012-08-12 16:00:02 +02:00
Fabio Erculiani f9ee58b48f [entropy.db.sql] add SQLConnectionWrapper.rawstring() and docstrings 2012-08-12 12:51:58 +02:00
Fabio Erculiani a8e2bbd3ba [entropy.db.sql] do not catch any exception in commit() 2012-08-12 12:08:23 +02:00
Fabio Erculiani c5e80d4153 [entropy.db.sql] define a common API for Cursor and Connection wrappers 2012-08-12 11:39:36 +02:00
Fabio Erculiani beb21f1660 [entropy.db] move other standard SQL code to entropy.db.sql 2012-08-12 10:29:41 +02:00
Fabio Erculiani 27a51598a0 [entropy.db] move most of the standard SQL code to entropy.db.sql 2012-08-11 21:58:41 +02:00
Fabio Erculiani dc4556ef46 [entropy.db] create entropy.db.sql (holding standard SQL methods)
entropy.db.mysql and entropy.db.sqlite are now subclassing
EntropySQLRepository. Methods will be moved there during the
next forthcoming overhaul. Implement ModuleProxy support and
alleviate the exception class objects issue (sqlite3 based
exceptions are thrown by entropy.db.sqlite and oursql based
exceptions are thrown by entropydb.mysql, and there is no
easy/quick fix for this apparently, besides wrapping all the
cursor calls).
2012-08-10 11:41:29 +02:00