-
Notifications
You must be signed in to change notification settings - Fork 621
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 timehashes to nip 52 #1752
base: master
Are you sure you want to change the base?
Add timehashes to nip 52 #1752
Conversation
Beautiful, elegant solution. |
Thinking through this more (thank you @arkin0x), there are degenerate scenarios in which long-duration events require many high-granularity hashes. This case can't be solved by only using lower-granularity hashes, because clients using high-granularity hashes in requests will no longer be able to find those events, and lower-granularity hashes force them to download and filter everything. So I decided that the simplest thing to do is just pick a granularity and use it. As it happens one day is probably a pretty good balance for most use cases. Date-only events already have that information (and are timezone-agnostic anyway), so I only had to add the tag to datetime events. |
17f360c
to
1723773
Compare
Beautiful, elegant solution. |
So if you want all events happening this Friday, you can look them up with the "D" tag and it will include week-long events including Friday. Sounds good to me. |
Flotilla now publishes and filters using the |
So if I wanted to get all the events for the next month, I would have to include ~30 D-tags in the subscription filter? |
How about this // Start timehashes
["T", "dy"],
["T", "dyj"],
["T", "dyju"],
// End timehashes
["D", "dy"],
["D", "dyj"],
["D", "dyju"], |
Yes. Not that bad if you compare it to the
This isn't terrible, but it doesn't allow targeting hashes during but not at the end or start of the event. You'd still have to scan backwards and forwards to get a complete list of events. |
This does the same thing for timestamps as geohashes does for locations. There's likely a better way to accomplish the task, so feel suggestions on the code snippets and algorithm are welcome.