Commit Graph

31 Commits

Author SHA1 Message Date
William Casarin a73271e3d4 debug: remove note size debug
ThreadSanitizer was complaining about a data race
2023-08-06 09:07:33 -07:00
William Casarin cebd1f48ca 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
2023-08-03 13:20:36 -07:00
William Casarin 6e6c1eb7b6 ndb: make AsciiCharacter a CustomStringConvertible 2023-08-01 21:53:19 -07:00
William Casarin 07dfa3b1fb ndb: update nostrdb
This include various fixes for parsing and key decoding
2023-08-01 21:53:19 -07:00
William Casarin 7040235605 refactor: add Pubkey, Privkey, NoteId string aliases
This is a non-behavioral change in preparation for the actual switchover
from Strings to Ids. The purpose of this kit is to reduce the size of
the switchover commit which is going to be very large.
2023-07-31 05:38:19 -07:00
William Casarin 593d0e2abe ndb: sync up a few remaining NdbNote tag differences 2023-07-25 16:22:25 -07:00
William Casarin 2f8aa29e92 ndb: make NostrEvents immutable
Since we can't mutate NdbNotes, let's update the existing codebase to
generate and sign ids on NostrEvent constructions. This will allow us to
match NdbNote's constructor
2023-07-25 15:34:05 -07:00
William Casarin 2053033b25 ndb: make note equatble
We need this for the switchover
2023-07-24 13:09:27 -07:00
William Casarin 2d44f2744b ndb: switch to computed property for tags
this will allows us to change less code on the switchover
2023-07-24 13:08:18 -07:00
William Casarin 04e408bfea ndb: implement a few more event things
We're basically done. Time to try the switch-over
2023-07-24 12:41:12 -07:00
William Casarin b5dd90b36a notes: generalize event_is_reply a bit
so that it works with NdbNote as well
2023-07-24 12:39:55 -07:00
William Casarin 6fa9149939 ndb: avoid double constructor on References 2023-07-24 11:05:18 -07:00
William Casarin 1e9e4a7f3a ndb: implement eventref building from ndb notes 2023-07-24 10:55:34 -07:00
William Casarin c8e236b6d5 ndb/test: add more test coverage on char iter 2023-07-23 12:21:36 -07:00
William Casarin e8d0f1db8d test: fix some ndb test warnings 2023-07-23 12:12:42 -07:00
William Casarin 99b5dc94cb ndb: copy over perf improvements 2023-07-23 12:11:08 -07:00
William Casarin e34351ca37 ndb: fix iterators, pack id tags, more tests 2023-07-23 11:55:36 -07:00
William Casarin 5c1043b4e5 ndb: add cchar constructors to AsciiCharacter
This will be used for the cchar iterator
2023-07-23 11:54:07 -07:00
William Casarin dd65209a20 Revert "ndb: remove TagIterators and just use sequences"
This reverts commit f0d07c3663.
2023-07-23 10:56:12 -07:00
William Casarin f0d07c3663 ndb: remove TagIterators and just use sequences
Still learning...
2023-07-22 21:12:53 -07:00
William Casarin b3119fa41e test: small test fix 2023-07-22 17:23:11 -07:00
William Casarin 7ec8da6c73 ndb: start implementing existing NostrEvent functionality
We eventually want to switch over to NdbNote instead of NostrEvent. To
facilitate this, the plan is to eventually make NostrEvent an alias of
NdbNote. For this to work, let's make sure the NostrEvent extensions are
implemented on NdbNote.

We will likely switch away from string properties as well, but for now
we will try to emulate as much as possible to make sure everything is
working first.
2023-07-22 17:19:47 -07:00
William Casarin 9e659c49b5 ndb/test: add a few more tests 2023-07-22 17:19:47 -07:00
William Casarin c72666b352 ndb: add subscript and count for TagsSequence
These are helpful
2023-07-22 17:19:47 -07:00
William Casarin 58e2fb40ef iter: make safer by using NdbNote instead of unsafe pointers
If we have an owned note, we could lose track of the lifetime and then
crash. Let's make sure we always have an NdbNote instead
2023-07-22 17:19:47 -07:00
William Casarin 0263c11a94 ndb: add content and owned_size 2023-07-22 17:19:47 -07:00
William Casarin 6d43754e71 ndb: add pubkey to NdbNote 2023-07-22 17:19:47 -07:00
William Casarin 4da23390f8 ndb: update lib 2023-07-22 17:19:47 -07:00
William Casarin c74993366b move copyndb to the right folder 2023-07-22 17:19:47 -07:00
William Casarin ad0e1f28b7 test: fix build and tests 2023-07-21 15:26:03 -07:00
William Casarin 61051ee853 nostrdb: add initial swift integration 2023-07-21 15:02:01 -07:00