Commit Graph

53 Commits

Author SHA1 Message Date
fiatjaf d43fbbf02d eventstore: fix lmdb and mmm ptag-kind queries.
the prefix was missing the 2 bytes of the kind when preparing the query.

we also simplify the query planner logic a little bit and eliminate some useless fields and everything is clearer.
2026-03-23 00:23:38 -03:00
fiatjaf d445ba9919 mmm: free ranges tracking improved with b.freeRangesLarge and b.freeRangesAll
one is unsorted and fast and we only care about it with picking a new free range.
the other is sorted and used when merging a new freed range with existing free ranges.
both are computed from the events id index at beginning, then tracked manually on each addition or deletion.
this change uncovered some errors so we fixed them and added some more fuzz test invariant checking.
code is simplified a little bit.
there was another thing I forgot.
2026-02-17 18:33:59 -03:00
fiatjaf 0cb0d1ccb0 unify usage and export nostr.IsOlder() helper. 2026-01-22 22:54:44 -03:00
fiatjaf ce7d165c9d mmm: eliminate annoying log line. 2026-01-19 22:33:35 -03:00
fiatjaf 459a10294f eventstore: a COUNT test and fix many bugs. 2026-01-18 21:31:12 -03:00
fiatjaf b559828c72 mmm: read-only mode. 2026-01-18 18:02:07 -03:00
fiatjaf 78f6509882 mmm: fix infinite loop on COUNT. 2026-01-15 16:14:29 -03:00
fiatjaf daee8575d9 filter.GetTheoreticalLimit() to encompass the actual limit specified in the filter. 2025-12-19 06:52:46 -03:00
fiatjaf 78d8f36e2d mmm: better ComputeStats() 2025-12-18 13:26:09 -03:00
fiatjaf 4d7f7ce25d mmm: stats return real pubkeys, not only prefixes. 2025-12-17 22:27:08 -03:00
fiatjaf 880b253d12 eventstore/mmm: stats. 2025-12-15 12:45:35 -03:00
fiatjaf fb3b14c69c eventstore: skip replacing when it's the exact same id. 2025-11-30 22:41:31 -03:00
fiatjaf 8161bd9ad1 mmm: create directory before creating the lockfile. 2025-11-23 06:57:54 -03:00
fiatjaf 55a43e46b7 use xhex everywhere. 2025-11-23 06:57:54 -03:00
fiatjaf 43fabbeb2a eventstore: more consistent ErrDupEvent firing. 2025-11-12 16:10:50 -03:00
fiatjaf 0aa0038c40 mmm: lockfile to prevent multiple instances. 2025-10-28 19:09:28 -03:00
fiatjaf fc16a36481 mmm: stop truncating mmap, reorder commits and write operations such that eventual inconsistencies are minimized and less harmful. 2025-10-16 03:11:11 +00:00
fiatjaf 98cbe66e16 mmm: test that free ranges are being used. 2025-10-16 01:43:51 +00:00
fiatjaf 0dcaf0fa95 mmm: fixes to rescan logic. 2025-10-15 23:02:32 +00:00
fiatjaf 5d2675f356 mmm: freeranges tests and fixes. 2025-10-15 03:50:00 +00:00
fiatjaf ac49036b77 mmm: small .EnsureLayer() change, fuzz tests for fixing borked databases 2025-10-15 01:31:44 +00:00
fiatjaf 9e41bc69c4 mmm: test .Rescan() 2025-10-14 01:46:42 +00:00
fiatjaf 53e838c61d mmm: freeranges computed on startup and kept only in memory. 2025-10-14 00:38:51 +00:00
fiatjaf bcc7575e04 mmm: do random rescans in the fuzz test to ensure they don't break anything. 2025-10-14 00:25:44 +00:00
fiatjaf 95c70e3225 mmm: Rescan() 2025-10-14 00:19:52 +00:00
fiatjaf 47b1608e6b mmm: fix fuzz test. 2025-10-13 21:53:48 +00:00
fiatjaf 96fcff7908 mmm: drop mmap on .Close() call. 2025-10-13 21:26:42 +00:00
fiatjaf 4d1774264a mmm: add debug helpers for fixing an inconsistent db. 2025-10-12 13:55:44 +00:00
fiatjaf 4754518278 mmm: querying by ids is restricted to the layer it was initiated. 2025-09-06 21:28:22 -03:00
fiatjaf 24b10ba2a5 eventstore: up limit to 10 on ReplaceEvent() 2025-08-06 00:28:21 -03:00
fiatjaf 92f6f75388 eventstore: fix yield() usage on ReplaceEvent() 2025-08-05 23:58:13 -03:00
fiatjaf 030cad168d eventstore: fuzz testing found us a bug! 2025-08-05 22:56:55 -03:00
fiatjaf 144f4a4740 eventstore: fix migrations annoyingly rerunning. 2025-08-05 13:09:50 -03:00
fiatjaf 34225e5dfe mmm: run it on the eventstore/test suite and fix id query logic. 2025-08-05 07:36:20 -03:00
fiatjaf 17c3d19a98 eventstore: remove useless sanity checking since event fields are already typed. 2025-08-05 00:04:27 -03:00
fiatjaf 7e6a0eb614 mmm: copy new lmdb querying mechanism because it's so much more elegant. 2025-08-05 00:03:57 -03:00
fiatjaf ca03dc60f7 eventstore/lmdb,mmm: fix key size for "a"-style tags. 2025-06-29 22:25:28 -03:00
fiatjaf 32df8e407a eventstore/mmm: we added another db on layers. 2025-06-29 21:43:55 -03:00
fiatjaf cc6ec3af73 simpler migrations (just reindex everything) and migrations on mmm. 2025-06-10 14:00:38 -03:00
fiatjaf e9a08d669e eventstore: index tag letter together with the value. 2025-06-10 13:46:29 -03:00
fiatjaf 9cad1f0a5b evenstore/mmm: fix wrong limit being read in queries. 2025-06-08 07:14:48 -03:00
fiatjaf 7b1f4ae49a fix types so tests compile. 2025-05-12 10:18:06 -03:00
fiatjaf 65411a10c8 eventstore: fix maxLimit handling when filter.Limit is unset. 2025-05-12 06:12:58 -03:00
fiatjaf f60fc08f8d eventstore: QueryEvents() to take a maxLimit param now so everything is clearer. 2025-05-11 09:36:59 -03:00
fiatjaf cda69b52a1 eventstore/mmm: fix query by id wrong size check. 2025-05-08 13:11:25 -03:00
fiatjaf c0934e0639 since and until are not pointers anymore because that is too annoying. 2025-05-08 09:32:54 -03:00
fiatjaf 15c6093c9b define a nostr.Kind type for event kinds, make adjustments everywhere and fix some horrible bugs with mmm, lmdb and badger querying and deleting. 2025-04-20 11:15:41 -03:00
fiatjaf 92c2de6294 eventstore tests. 2025-04-18 11:29:31 -03:00
fiatjaf 5b8954461f it never ends. 2025-04-16 02:59:47 -03:00
fiatjaf cb0dd45a32 go mod tidy works now at least. 2025-04-15 18:40:56 -03:00