Commit Graph

1167 Commits

Author SHA1 Message Date
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
eada088f56 [entropy.client.db] do not catch KeyError for update() but just during object init 2013-12-11 22:19:40 +01:00
Fabio Erculiani
43f4bd5ee3 Release Entropy 248 2013-12-11 16:39:02 +01:00
Fabio Erculiani
68fe99d33e [entropy.db.sqlite] acquire an exclusive lock if schema updates are needed
_maybeDatabaseSchemaUpdates is only called inside the costructor,
at that time, it's not possible to acquire the lock elsewhere
because the object doesn't exist yet.
2013-12-11 07:49:04 +01:00
Fabio Erculiani
061b02bebc [entropy.db.sqlite] move indexing setup back to object constructor
This has nothing to do with schema update
2013-12-11 07:43:50 +01:00
Fabio Erculiani
de88d6cc73 [entropy.client.repository] wrap Repository.sync() around a ResourceLock 2013-12-10 22:22:41 +01:00
Fabio Erculiani
82d6d37bcf [entropy.db.sqlite] move schema update code away from __init__ 2013-12-10 21:58:19 +01:00
Fabio Erculiani
7808ad6b92 [entropy.db.sqlite] migrate locking code to entropy.locks.ResourceLock
The new EntropySQLiteRepository uses ResourceLock, and gains support
for reentrancy, anti-deadlock safety measures (only for nested calls),
unification of memory and file repositories locking code (the semantics
was already the same).
2013-12-10 21:42:34 +01:00
Fabio Erculiani
401b9cbeb3 [entropy.client.loaders] Security: pass args and kwargs down to the object constructor 2013-12-10 16:42:34 +01:00
Fabio Erculiani
498674828d [entropy.tools] get_hash_from_md5_file: do not hide IOError exceptions 2013-12-10 16:39:55 +01:00
Fabio Erculiani
fc597d04c5 [entropy.security] refactor System, add internal locking support, improve speed 2013-12-10 16:39:17 +01:00
Fabio Erculiani
b99def9128 [entropy.locks] add exclusive() and shared() context managers 2013-12-10 11:22:42 +01:00
Fabio Erculiani
47e9b6ee0e [entropy.locks] rename _GenericResourceLock to ResourceLock 2013-12-10 05:39:59 +01:00
Fabio Erculiani
94ab49fd0b [tests] use const_mk{s,d}temp instead of tmpfile ones, default TMPDIR to /var/tmp 2013-12-09 14:36:34 +01:00
Fabio Erculiani
6a2d45df47 [entropy.locks] set recursed to False only when the reference counter is 0 2013-12-09 14:24:37 +01:00
Fabio Erculiani
d080db0d3b [tests] locks: fix test class name 2013-12-09 14:21:05 +01:00
Fabio Erculiani
bf3a8b79f9 [entropy.locks] use TLS for reentrancy safety checks, update tests 2013-12-09 14:19:21 +01:00
Fabio Erculiani
7e30b65744 [entropy.locks] _file_lock_create: beautify, open O_CREAT | O_RDONLY if shared mode 2013-12-08 16:33:29 +01:00
Fabio Erculiani
ebf63e6060 [entropy.locks] fix shared/exclusive locking mix due to reentrancy, add tests 2013-12-08 16:15:39 +01:00
Fabio Erculiani
97f18338ba [entropy.locks] move acquire_lock(), release_lock() from entropy.tools 2013-12-08 14:54:42 +01:00
Fabio Erculiani
d0f11728c8 [entropy.security] remove unlocked_sync(), locking happens externally nowadays 2013-12-08 14:46:05 +01:00
Fabio Erculiani
358c6cc80c [entropy.client.repository] drop unlocked_sync(), locking happens externally nowadays 2013-12-08 14:42:23 +01:00
Fabio Erculiani
1917771b54 [entropy.locks] move Entropy Resources Lock code to a separate module 2013-12-08 14:37:57 +01:00
Fabio Erculiani
b1ed42d80a [entropy.db.skel] drop __atomMatchValidateCache
SHA1 is used nowadays and all the caching bugs should be fixed
rather than being hidden.
2013-12-08 06:28:08 +01:00
Fabio Erculiani
1688ce53ac [entropy.client] clean_downloaded_packages, add skip_available_packages keyword arg
skip_available_packages can be used to filter out the removal of
package tarballs still belonging to available packages. This makes
possible to just use a shared Entropy Resources lock.
2013-12-07 20:30:07 +01:00
Fabio Erculiani
16025afc75 [entropy.client.package] move "QA:" to translatable strings 2013-12-07 20:30:07 +01:00
Fabio Erculiani
e75b95a1b3 [entropy.client.package] workout_subdir: do not rmtree if symlink expected but directory found 2013-12-07 20:30:06 +01:00
Fabio Erculiani
e6cca25473 [entropy.client.package] fail (rather than rmtree) when a file is expected but directory is found 2013-12-07 20:30:06 +01:00
Fabio Erculiani
0d486bc470 [entropy.client.package] if a directory is a file, do not unlink() but rename() 2013-12-07 20:30:06 +01:00
Fabio Erculiani
a0d4711cdc [entropy.client.package.actions] remove: commit after insertSpmUid() 2013-12-07 20:30:06 +01:00
Fabio Erculiani
6d4f9e3089 [entropy.client.package.actions] install: commit after insertSpmUid() 2013-12-07 20:30:06 +01:00
Fabio Erculiani
b26842e826 [entropy.db] direct: wrap yield around a try/finally block 2013-12-07 20:30:06 +01:00
Fabio Erculiani
3545f2b619 [entropy.db] add direct access support to repository
In latency sensitive code paths, the performance penality caused
by file lock contention and memory cache invalidation is too high.
This problem happens in Rigo, which is extremely latency sensitive.
Since we don't want to crap on the user, a way to solve this is
letting API consumers skip the memory cache and read data directly
from the database store. The trade off is that data may be stale,
incomplete, or invalid, but as long as the consumer is aware of this,
that's fine.
2013-12-07 20:30:06 +01:00
Fabio Erculiani
f8d0511506 [entropy.client.package.actions] multifetch: fix pre_download_hook for edeltas 2013-12-07 20:30:06 +01:00
Fabio Erculiani
65f5dce076 [entropy.client.package] add sys import 2013-12-07 20:30:06 +01:00
Fabio Erculiani
a8c98a5081 [entropy.client.package.actions] action: cope with unavailability of file locking
Some filesystems, especially old network file systems, don't support
file locking. Try not to explode if this is the case but rather nag
the user with scary error messages.
2013-12-07 20:30:06 +01:00
Fabio Erculiani
7378906396 [entropy.misc] ReadersWritersSemaphore: add reader() and writer() context managers 2013-12-07 20:29:20 +01:00
Fabio Erculiani
68f5fd0320 [entropy.client] Trigger: lazily load the Source Package Manager instance object 2013-12-07 20:29:20 +01:00
Fabio Erculiani
6af6a2115e [entropy.client] move Trigger class under package.actions, make it "private" 2013-12-07 20:29:20 +01:00
Fabio Erculiani
818f96fdf7 [entropy.db.sqlite] increase sqlite3 internal lock timeout to 60 seconds 2013-12-07 20:29:20 +01:00
Fabio Erculiani
a8fcfd7b15 [kswitch] add concurrency support 2013-12-07 20:29:19 +01:00
Fabio Erculiani
9c38af6a34 [entropy.security] document installed repository lock usage requirements
entropy.Security will undergo a complete overhaul in the next months.
2013-12-07 20:29:19 +01:00
Fabio Erculiani
53a1b117ae [entropy.client.package] preservedlibs: update API documentation 2013-12-07 20:29:19 +01:00
Fabio Erculiani
1c7b684aa4 [entropy.client.misc] make ConfigurationFiles process and thread safe wrt inst_repo 2013-12-07 20:29:19 +01:00
Fabio Erculiani
2393f5dda2 [entropy.client] update API documentation with information regarding repository locking 2013-12-07 20:29:19 +01:00
Fabio Erculiani
d802bb8186 [entropy.db.skel] clarify the cases where locking could be avoided 2013-12-07 20:29:18 +01:00
Fabio Erculiani
fa68f56545 [entropy.client.package.actions] install: pass remove_package_id to _install_package_unlocked 2013-12-07 20:29:18 +01:00
Fabio Erculiani
95c69168c5 [entropy.db.sqlite] make possible to acquire the repository lock file in shared mode by users 2013-12-07 20:29:18 +01:00
Fabio Erculiani
86b25739c7 [entropy.client.package.actions] remove: add concurrency support 2013-12-07 20:29:18 +01:00
Fabio Erculiani
e6e020e404 [entropy.client.package.actions] _manage: move _get_remove_trigger_data() here 2013-12-07 20:29:18 +01:00