- self.idx = self.indextype(self.store.db(), self.name, self.typ)
+ self.idx = self.indextype(self.store.db(), self.name, self.typ, tx=tx)
def get1(self, *, check=False, default=KeyError, **kwargs):
with self.get(**kwargs) as cursor:
def get1(self, *, check=False, default=KeyError, **kwargs):
with self.get(**kwargs) as cursor:
def register(self, id, obj, tx):
val = self.__get__(obj, None)
def register(self, id, obj, tx):
val = self.__get__(obj, None)
tx.postcommit(lambda: setattr(obj, self.iattr, val))
def unregister(self, id, obj, tx):
tx.postcommit(lambda: setattr(obj, self.iattr, val))
def unregister(self, id, obj, tx):
- self.index().remove(getattr(obj, self.iattr), id, tx=tx)
+ self.index(tx).remove(getattr(obj, self.iattr), id, tx=tx)
tx.postcommit(lambda: delattr(obj, self.iattr))
def update(self, id, obj, tx):
val = self.__get__(obj, None)
ival = getattr(obj, self.iattr)
if val != ival:
tx.postcommit(lambda: delattr(obj, self.iattr))
def update(self, id, obj, tx):
val = self.__get__(obj, None)
ival = getattr(obj, self.iattr)
if val != ival:
idx.remove(ival, id, tx=tx)
idx.put(val, id, tx=tx)
tx.postcommit(lambda: setattr(obj, self.iattr, val))
idx.remove(ival, id, tx=tx)
idx.put(val, id, tx=tx)
tx.postcommit(lambda: setattr(obj, self.iattr, val))
def register(self, id, obj, tx):
vals = frozenset(self.__get__(obj, None))
def register(self, id, obj, tx):
vals = frozenset(self.__get__(obj, None))
for val in vals:
idx.put(val, id, tx=tx)
tx.postcommit(lambda: setattr(obj, self.iattr, vals))
def unregister(self, id, obj, tx):
for val in vals:
idx.put(val, id, tx=tx)
tx.postcommit(lambda: setattr(obj, self.iattr, vals))
def unregister(self, id, obj, tx):
for val in getattr(obj, self.iattr):
idx.remove(val, id, tx=tx)
tx.postcommit(lambda: delattr(obj, self.iattr))
for val in getattr(obj, self.iattr):
idx.remove(val, id, tx=tx)
tx.postcommit(lambda: delattr(obj, self.iattr))
vals = frozenset(self.__get__(obj, None))
ivals = getattr(obj, self.iattr)
if vals != ivals:
vals = frozenset(self.__get__(obj, None))
ivals = getattr(obj, self.iattr)
if vals != ivals:
def register(self, id, obj, tx):
val = tuple(part.__get__(obj, None) for part in self.parts)
def register(self, id, obj, tx):
val = tuple(part.__get__(obj, None) for part in self.parts)
tx.postcommit(lambda: setattr(obj, self.iattr, val))
def unregister(self, id, obj, tx):
tx.postcommit(lambda: setattr(obj, self.iattr, val))
def unregister(self, id, obj, tx):
- self.index().remove(getattr(obj, self.iattr), id, tx=tx)
+ self.index(tx).remove(getattr(obj, self.iattr), id, tx=tx)
tx.postcommit(lambda: delattr(obj, self.iattr))
def update(self, id, obj, tx):
val = tuple(part.__get__(obj, None) for part in self.parts)
ival = getattr(obj, self.iattr)
if val != ival:
tx.postcommit(lambda: delattr(obj, self.iattr))
def update(self, id, obj, tx):
val = tuple(part.__get__(obj, None) for part in self.parts)
ival = getattr(obj, self.iattr)
if val != ival:
idx.remove(ival, id, tx=tx)
idx.put(val, id, tx=tx)
tx.postcommit(lambda: setattr(obj, self.iattr, val))
idx.remove(ival, id, tx=tx)
idx.put(val, id, tx=tx)
tx.postcommit(lambda: setattr(obj, self.iattr, val))