Sort statewise results

This commit is contained in:
lash 2022-04-30 16:43:55 +00:00
parent c94b291d39
commit b8c2b1b86a
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
1 changed files with 8 additions and 2 deletions

View File

@ -77,21 +77,27 @@ class Store:
return (s, v,)
def by_state(self, state=0, limit=4096, strict=False, threshold=None):
def by_state(self, state=0, not_state=0, limit=4096, strict=False, threshold=None):
hashes = []
i = 0
refs_state = self.state_store.list(state)
refs_state.sort()
for ref in refs_state:
v = from_key(ref)
hsh = v[2]
item_state = self.state_store.state(ref)
if strict:
item_state = self.state_store.state(ref)
if item_state & state != item_state:
continue
logg.info('state {} {}'.format(ref, item_state))
if item_state & not_state > 0:
continue
if threshold != None:
v = self.state_store.modified(ref)
if v > threshold: