local thread subscriptions

This adds local nostrdb thread subscriptions. When navigating to a
thread, we first check to see if we have any active nostrdb
subscriptions for that thread. If not, we create a new subscription. If
we do, we re-use that subscription.

This works by storing thread state in the Threads struct in the Damus
application state.

When we pop a route, we check to see if its a thread route. If it is,
then we try to unsubscribe, but only if that is the last remaining
subscriber for that thread, as there could be more than one.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-07-23 14:10:00 -07:00
parent 33e5b6886b
commit a28db5d330
9 changed files with 459 additions and 165 deletions

2
Cargo.lock generated
View File

@@ -2296,7 +2296,7 @@ dependencies = [
[[package]]
name = "nostrdb"
version = "0.3.4"
source = "git+https://github.com/damus-io/nostrdb-rs?rev=8ef4b9c26145572ad7543d955778499e84723099#8ef4b9c26145572ad7543d955778499e84723099"
source = "git+https://github.com/damus-io/nostrdb-rs?branch=threads#27e7c19c8941fe996490a82512fd2660e5da1900"
dependencies = [
"bindgen",
"cc",