def readItem(self, view, afterLoadHooks): super(DBItemRMergeReader, self).readItem(view, afterLoadHooks) if self.merged: self.dirties = HashTuple( filter(lambda h: h not in self.merged, self.dirties)) self.item._references._dirties = self.dirties
def _mergeVDIRTY(self, item, toVersion, dirties, mergeFn): dirties = HashTuple(dirties) store = self.repository.store args = store._items.loadItem(toVersion, item._uuid) DBItemVMergeReader(store, item, dirties, mergeFn, *args).readItem(self, [])
def readItem(self, view, afterLoadHooks): super(DBItemRMergeReader, self).readItem(view, afterLoadHooks) if self.merged: self.dirties = HashTuple(filter(lambda h: h not in self.merged, self.dirties)) self.item._references._dirties = self.dirties
class DBItemRMergeReader(DBItemMergeReader): def __init__(self, store, item, dirties, oldVersion, *args): super(DBItemRMergeReader, self).__init__(store, item, dirties, None, *args) self.merged = [] self.oldVersion = oldVersion self.oldDirties = item._references._getDirties() def readItem(self, view, afterLoadHooks): super(DBItemRMergeReader, self).readItem(view, afterLoadHooks) if self.merged: self.dirties = HashTuple( filter(lambda h: h not in self.merged, self.dirties)) self.item._references._dirties = self.dirties def _value(self, offset, data, kind, withSchema, attribute, view, name, afterLoadHooks): return offset, Nil def _ref(self, offset, data, kind, withSchema, attribute, view, name, afterLoadHooks): if name in self.dirties: flags = ord(data[offset]) if flags & DBItemWriter.LIST: if name in self.oldDirties: value = self.item._references.get(name, None) if value is not None and value._isRefList(): value._mergeChanges(self.oldVersion, self.version) self.merged.append(self.dirties.hash(name)) return offset, Nil else: offset, value = super(DBItemRMergeReader, self)._ref(offset, data, kind, withSchema, attribute, view, name, afterLoadHooks) value._setItem(self.item) return offset, value return offset, Nil
class DBItemRMergeReader(DBItemMergeReader): def __init__(self, store, item, dirties, oldVersion, *args): super(DBItemRMergeReader, self).__init__(store, item, dirties, None, *args) self.merged = [] self.oldVersion = oldVersion self.oldDirties = item._references._getDirties() def readItem(self, view, afterLoadHooks): super(DBItemRMergeReader, self).readItem(view, afterLoadHooks) if self.merged: self.dirties = HashTuple(filter(lambda h: h not in self.merged, self.dirties)) self.item._references._dirties = self.dirties def _value(self, offset, data, kind, withSchema, attribute, view, name, afterLoadHooks): return offset, Nil def _ref(self, offset, data, kind, withSchema, attribute, view, name, afterLoadHooks): if name in self.dirties: flags = ord(data[offset]) if flags & DBItemWriter.LIST: if name in self.oldDirties: value = self.item._references.get(name, None) if value is not None and value._isRefList(): value._mergeChanges(self.oldVersion, self.version) self.merged.append(self.dirties.hash(name)) return offset, Nil else: offset, value = super(DBItemRMergeReader, self)._ref(offset, data, kind, withSchema, attribute, view, name, afterLoadHooks) value._setItem(self.item) return offset, value return offset, Nil