-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zac Medico wrote:
> I was playing with the metadata cache stuff this weekend and decided to
> write a patch that obsoletes metadata transfers on sync.

I have reimplemented the previous patch as a normal cache module that adds a 
writable layer on top of the pre-generated metadata.  If you'd like to try this 
out (with portage-2.1_preX), simply copy metadata_overlay.py into 
/usr/lib/portage/pym/cache/ and add portdbapi.auxdbmodule = 
cache.metadata_overlay.database to /etc/portage/modules.

I haven't tested this much, but like the previous patch, this shouldn't cause 
any harm. Feedback would be appreciated.

Zac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD20nu/ejvha5XGaMRAumKAJ9iyEsxsyi59Iri+fZ3pA6bWs38xwCeI5SW
D3OJhsbTGr8w+BviOEpfAIA=
=v/bi
-----END PGP SIGNATURE-----
# Copyright: 2006 Gentoo Foundation
# Author(s): Zac Medico ([EMAIL PROTECTED])
# License: GPL2

import template, flat_hash, metadata
if not hasattr(__builtins__, "set"):
	from sets import Set as set

from flat_hash import database as db_rw
from metadata import database as db_ro

class database(template.database):

	autocommits = True
	serialize_eclasses = False

	def __init__(self, location, label, auxdbkeys, **config):
		super(database, self).__init__(location, label, auxdbkeys)
		self.db_rw = db_rw(location, label, auxdbkeys, **config)
		self.db_ro = db_ro(label,"metadata/cache",auxdbkeys)

	def __getitem__(self, cpv):
		try:
			return self.db_rw[cpv]
		except KeyError:
			return self.db_ro[cpv]

	def _setitem(self, name, values):
		self.db_rw[name] = values

	def _delitem(self, cpv):
		try:
			del self.db_rw[cpv]
		except KeyError, ke:
			if not self.db_ro.has_key(cpv):
				raise ke

	def has_key(self, cpv):
		return self.db_rw.has_key(cpv) or self.db_ro.has_key(cpv)

	def iterkeys(self):
		s = set()
		for db in (self.db_rw, self.db_ro):
			for cpv in db.iterkeys():
				if cpv not in s:
					yield cpv
					s.add(cpv)

Reply via email to