ndb: switch to nostrdb notes

This is a refactor of the codebase to use a more memory-efficient
representation of notes. It should also be much faster at decoding since
we're using a custom C json parser now.

Changelog-Changed: Improved memory usage and performance when processing events
This commit is contained in:
William Casarin
2023-07-26 08:46:44 -07:00
parent 55bbe8f855
commit cebd1f48ca
110 changed files with 2153 additions and 1799 deletions

View File

@@ -31,18 +31,16 @@ struct FollowButtonView: View {
.stroke(follow_state == .unfollows ? .clear : borderColor(), lineWidth: 1)
}
}
.onReceive(handle_notify(.followed)) { pk in
guard pk.key == "p", target.pubkey == pk.ref_id else {
return
}
.onReceive(handle_notify(.followed)) { follow in
guard case .pubkey(let pk) = follow,
pk == target.pubkey else { return }
self.follow_state = .follows
}
.onReceive(handle_notify(.unfollowed)) { pk in
guard pk.key == "p", target.pubkey == pk.ref_id else {
return
}
.onReceive(handle_notify(.unfollowed)) { unfollow in
guard case .pubkey(let pk) = unfollow,
pk == target.pubkey else { return }
self.follow_state = .unfollows
}
}
@@ -65,7 +63,7 @@ struct FollowButtonView: View {
}
struct FollowButtonPreviews: View {
let target: FollowTarget = .pubkey("")
let target: FollowTarget = .pubkey(test_pubkey)
var body: some View {
VStack {
Text(verbatim: "Unfollows")