relstorage.adapters.packundo
– Pack/Undo implementations¶
Pack/Undo implementations.
- class HistoryFreePackUndo(database_driver, connmanager, runner, locker, options)[source]¶
Bases:
PackUndo
History-free pack/undo.
- fill_object_refs(load_connection, store_connection, get_references)[source]¶
Update the object_refs table by analyzing new object states.
See
pre_pack()
for a description of the parameters.Because load_connection is read-only and repeatable read, we don’t need to do any object-level locking.
- pack(pack_tid, packed_func=None)[source]¶
Run garbage collection.
Requires the information provided by pre_pack.
- pre_pack(pack_tid, get_references)[source]¶
Decide what the garbage collector should delete.
Objects created or modified after pack_tid will not be garbage collected.
get_references is a function that accepts a pickled state and returns a set of OIDs that state refers to.
The self.options.pack_gc flag indicates whether to run garbage collection. If pack_gc is false, this method does nothing.
- class HistoryPreservingPackUndo(database_driver, connmanager, runner, locker, options)[source]¶
Bases:
PackUndo
History-preserving pack/undo.
- fill_object_refs(load_connection, store_connection, get_references)[source]¶
Update the object_refs table by analyzing new transactions.
- pre_pack(pack_tid, get_references)[source]¶
Decide what to pack.
pack_tid specifies the most recent transaction to pack.
get_references is a function that accepts a pickled state and returns a set of OIDs that state refers to.
The self.options.pack_gc flag indicates whether to run garbage collection. If pack_gc is false, at least one revision of every object is kept, even if nothing refers to it. Packing with pack_gc disabled can be much faster.
- class PackUndo(database_driver, connmanager, runner, locker, options)[source]¶
Bases:
DatabaseHelpersMixin
Abstract base class for pack/undo
- check_refs(pack_tid)[source]¶
Are there any objects we’re not going to garbage collect that point to an object that doesn’t exist? Note that this goes only one level deep. A whole subtree of objects may be removed by a subsequent pack if the only reference them was from a missing object.
Logs a warning for each discovered broken reference.
Returns a true object if there were broken references, a false object otherwise.