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

@@ -6,34 +6,3 @@
//
import Foundation
enum PostBlock {
case text(String)
case ref(ReferencedId)
case hashtag(String)
var is_text: String? {
if case .text(let txt) = self {
return txt
}
return nil
}
var is_hashtag: String? {
if case .hashtag(let ht) = self {
return ht
}
return nil
}
var is_ref: ReferencedId? {
if case .ref(let ref) = self {
return ref
}
return nil
}
}
func parse_post_textblock(str: String, from: Int, to: Int) -> PostBlock {
return .text(String(substring(str, start: from, end: to)))
}