support multiple column families in one raw multi_get call

This commit is contained in:
Jack Robison 2022-10-12 11:52:55 -04:00
parent abc5184e19
commit 606e9bb0d6

View file

@ -283,10 +283,8 @@ class BasePrefixDB:
if len(keys) == 0: if len(keys) == 0:
return [] return []
first_key = keys[0] first_key = keys[0]
if not all(first_key[0] == key[0] for key in keys): get_cf = self.column_families.__getitem__
raise ValueError('cannot multi-delete across column families') db_result = self._db.multi_get([(get_cf(k[:1]), k) for k in keys], fill_cache=fill_cache)
cf = self.column_families[first_key[:1]]
db_result = self._db.multi_get([(cf, k) for k in keys], fill_cache=fill_cache)
return list(db_result.values()) return list(db_result.values())
def multi_delete(self, items: typing.List[typing.Tuple[bytes, bytes]]): def multi_delete(self, items: typing.List[typing.Tuple[bytes, bytes]]):