Joseph Doherty
09252b8c79
feat(storage): add MsgBlock block-based message storage unit
...
MsgBlock is the unit of storage in the file store — a single append-only
block file containing sequentially written binary message records. Blocks
are sealed (read-only) when they reach a configurable byte-size limit.
Key features:
- Write: appends MessageRecord-encoded messages with auto-incrementing
sequence numbers and configurable first sequence offset
- Read: positional I/O via RandomAccess.Read for concurrent reader safety
- Delete: soft-delete with on-disk persistence (re-encodes flags byte +
checksum so deletions survive recovery)
- Recovery: rebuilds in-memory index by scanning block file using
MessageRecord.MeasureRecord for record boundary detection
- Thread safety: ReaderWriterLockSlim allows concurrent reads during writes
Also adds MessageRecord.MeasureRecord() — computes a record's byte length
by parsing varint field headers without full decode, needed for sequential
record scanning during block recovery.
Reference: golang/nats-server/server/filestore.go:217-267 (msgBlock struct)
12 tests covering write, read, delete, seal, recovery, concurrency,
and custom sequence offsets.
2026-02-24 12:21:33 -05:00
..
2026-02-24 09:05:28 -05:00
2026-02-23 13:08:52 -05:00
2026-02-23 20:42:42 -05:00
2026-02-24 08:58:24 -05:00
2026-02-24 09:00:01 -05:00
2026-02-23 22:35:06 -05:00
2026-02-23 20:56:20 -05:00
2026-02-23 13:08:52 -05:00
2026-02-24 12:21:33 -05:00
2026-02-23 21:40:29 -05:00
2026-02-23 21:40:29 -05:00
2026-02-23 21:40:29 -05:00
2026-02-23 14:32:55 -05:00
2026-02-23 13:08:52 -05:00
2026-02-24 06:40:41 -05:00
2026-02-23 22:35:06 -05:00
2026-02-23 13:08:52 -05:00
2026-02-24 09:15:17 -05:00
2026-02-23 13:08:52 -05:00
2026-02-23 06:04:02 -05:00
2026-02-23 05:27:36 -05:00
2026-02-22 23:00:59 -05:00
2026-02-23 04:22:36 -05:00
2026-02-23 04:33:44 -05:00
2026-02-23 00:46:16 -05:00
2026-02-22 23:07:31 -05:00
2026-02-22 22:55:50 -05:00
2026-02-22 22:19:18 -05:00
2026-02-22 22:44:58 -05:00
2026-02-23 00:53:15 -05:00
2026-02-22 23:33:21 -05:00
2026-02-23 19:26:30 -05:00
2026-02-23 05:41:42 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 19:26:30 -05:00
2026-02-22 22:41:45 -05:00
2026-02-23 21:40:29 -05:00
2026-02-23 19:26:30 -05:00
2026-02-23 19:26:30 -05:00
2026-02-22 23:41:44 -05:00
2026-02-23 04:26:15 -05:00
2026-02-23 19:26:30 -05:00
2026-02-23 05:43:04 -05:00
2026-02-23 22:55:41 -05:00
2026-02-23 04:57:34 -05:00
2026-02-23 06:04:02 -05:00
2026-02-23 04:53:25 -05:00
2026-02-23 14:56:27 -05:00
2026-02-23 15:03:35 -05:00
2026-02-23 05:34:57 -05:00
2026-02-23 06:00:42 -05:00
2026-02-23 14:40:07 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 05:55:45 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 06:24:41 -05:00
2026-02-23 05:59:36 -05:00
2026-02-22 21:14:16 -05:00
2026-02-23 05:22:58 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 06:09:26 -05:00
2026-02-23 21:06:16 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 05:58:34 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 06:23:34 -05:00
2026-02-23 05:59:03 -05:00
2026-02-23 06:06:02 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 13:43:14 -05:00
2026-02-23 13:43:14 -05:00
2026-02-23 06:21:51 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 06:10:41 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 06:05:01 -05:00
2026-02-23 06:03:24 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 06:07:02 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 06:08:14 -05:00
2026-02-23 06:04:23 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 05:55:45 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 06:02:07 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 06:17:30 -05:00
2026-02-23 06:19:41 -05:00
2026-02-23 05:37:04 -05:00
2026-02-23 20:06:54 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 01:05:10 -05:00
2026-02-23 06:00:10 -05:00
2026-02-24 09:03:05 -05:00
2026-02-23 11:04:43 -05:00
2026-02-22 22:13:50 -05:00
2026-02-23 06:07:38 -05:00
2026-02-23 06:25:23 -05:00
2026-02-23 04:20:56 -05:00
2026-02-23 04:35:46 -05:00
2026-02-23 00:33:24 -05:00
2026-02-23 05:03:17 -05:00
2026-02-22 22:41:45 -05:00
2026-02-22 23:03:41 -05:00
2026-02-22 23:56:49 -05:00
2026-02-23 04:23:14 -05:00
2026-02-23 04:38:01 -05:00
2026-02-23 19:26:30 -05:00
2026-02-22 23:03:41 -05:00
2026-02-23 00:33:15 -05:00
2026-02-23 04:33:45 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 06:13:08 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 06:12:18 -05:00
2026-02-23 10:16:16 -05:00
2026-02-23 06:13:08 -05:00
2026-02-23 12:11:19 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 06:03:37 -05:00
2026-02-23 00:59:15 -05:00
2026-02-23 05:55:45 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 11:04:43 -05:00
2026-02-23 00:34:30 -05:00
2026-02-23 19:26:30 -05:00
2026-02-23 00:38:43 -05:00
2026-02-23 00:09:30 -05:00
2026-02-22 22:41:45 -05:00
2026-02-23 21:06:16 -05:00
2026-02-23 00:33:43 -05:00
2026-02-23 04:45:08 -05:00
2026-02-23 04:27:36 -05:00
2026-02-23 19:26:30 -05:00
2026-02-23 00:50:26 -05:00
2026-02-23 05:44:09 -05:00
2026-02-23 05:48:32 -05:00
2026-02-22 22:28:19 -05:00
2026-02-22 22:13:53 -05:00
2026-02-23 00:55:29 -05:00
2026-02-23 00:57:14 -05:00
2026-02-22 22:40:03 -05:00
2026-02-22 22:24:53 -05:00
2026-02-22 22:41:45 -05:00
2026-02-22 23:54:41 -05:00
2026-02-22 23:47:31 -05:00