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

@@ -32,8 +32,8 @@ class ProfileDatabaseTests: XCTestCase {
}
func testStoreAndRetrieveProfile() async throws {
let id = "test-id"
let id = test_pubkey
let profile = test_profile
// make sure it's not there yet
@@ -58,7 +58,7 @@ class ProfileDatabaseTests: XCTestCase {
}
func testRejectOutdatedProfile() async throws {
let id = "test-id"
let id = test_pubkey
// store a profile
let profile = test_profile
@@ -80,8 +80,8 @@ class ProfileDatabaseTests: XCTestCase {
}
func testUpdateExistingProfile() async throws {
let id = "test-id"
let id = test_pubkey
// store a profile
let profile = test_profile
let profile_last_update = Date.now
@@ -102,7 +102,7 @@ class ProfileDatabaseTests: XCTestCase {
XCTAssertEqual(database.count, 0)
// store a profile
let id = "test-id"
let id = test_pubkey
let profile = test_profile
let profile_last_update = Date.now
try await database.upsert(id: id, profile: profile, last_update: profile_last_update)
@@ -110,7 +110,7 @@ class ProfileDatabaseTests: XCTestCase {
XCTAssertEqual(database.count, 1)
// store another profile
let id2 = "test-id-2"
let id2 = test_pubkey_2
let profile2 = test_profile
let profile_last_update2 = Date.now
try await database.upsert(id: id2, profile: profile2, last_update: profile_last_update2)