Set a row factory instead of nesting the iterator in __objects
This commit is contained in:
parent
addf75814e
commit
f6d528a035
|
@ -41,14 +41,16 @@ class Inventory():
|
||||||
cur.execute("INSERT INTO status VALUES ('lastvacuumtime', ?)", (now,))
|
cur.execute("INSERT INTO status VALUES ('lastvacuumtime', ?)", (now,))
|
||||||
self._db.commit()
|
self._db.commit()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def __object(cursor, row):
|
||||||
|
vector, expires, obj_type, version, stream, tag, data, offset = row
|
||||||
|
return structure.Object(
|
||||||
|
expires, obj_type, version, stream, data, offset,
|
||||||
|
tag=tag, vector=vector)
|
||||||
|
|
||||||
def __objects(self, cur):
|
def __objects(self, cur):
|
||||||
return (
|
cur.row_factory = self.__object
|
||||||
structure.Object(
|
return cur
|
||||||
expires, obj_type, version, stream, data, offset,
|
|
||||||
tag=tag, vector=vector)
|
|
||||||
for (vector, expires, obj_type, version, stream, tag, data, offset)
|
|
||||||
in cur.fetchall()
|
|
||||||
)
|
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
with shared.objects_lock:
|
with shared.objects_lock:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user