Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filters and reverse ordering in Noter and Notifier #816

Closed

Conversation

rodolfomiranda
Copy link
Contributor

This PR address a feature requested in KERIA (WebOfTrust/keria#266) to allow notifications to be ordered in reverse, and be filtered by the read status and the route parameter in the attrs (note.a.r) if exists.

To get the notes in reversed order I added a new function in LMDBer called getAllItemRvsdIter that returns the reversed iterator.

@@ -581,6 +581,37 @@ def getAllItemIter(self, db, key=b'', split=True, sep=b'.'):
splits = (bytes(key), val)
yield tuple(splits)

def getAllItemRvsdIter(self, db, key=b'', split=True, sep=b'.'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a method that implements something similar to this and is called getIoValsAllPreBackIter. This name should match.

@@ -353,7 +367,49 @@ def getNotes(self, start=0, end=25):
break

return notes

def getFltNotes(self, start=0, end=25, rvsd=False, read=None, route=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is an appropriate approach for filtering messages in LMDB. It requires deserializing the data and analyzing it and it hard codes the fields you can search for.

If you look at the Seeker class in KERIA you'll see an approach to creating LMDB indexes that are more flexible and more performant than this approach.

@rodolfomiranda rodolfomiranda marked this pull request as draft July 31, 2024 13:49
@pfeairheller
Copy link
Member

Can this PR be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants