feat: add atomic batch publish engine & versioning support (Tasks 9-10)

- AtomicBatchPublishEngine: stage/commit/rollback semantics for batch publish
- JsVersioning: API level negotiation and stream/consumer metadata
- Fix NormalizeConfig missing AllowAtomicPublish, Metadata, PersistMode copy
- 46 batch publish tests + 67 versioning tests, all passing
This commit is contained in:
Joseph Doherty
2026-02-24 22:05:07 -05:00
parent cd009b9342
commit b80316a42f
10 changed files with 953 additions and 5 deletions

View File

@@ -52,6 +52,36 @@ public sealed class StreamConfig
// Incompatible with Mirror and Sources.
// Go reference: server/stream.go:369 (AllowMsgSchedules field)
public bool AllowMsgSchedules { get; set; }
// Go: StreamConfig.AllowMsgCounter — enables CRDT counter semantics on messages.
// Added in v2.12, requires API level 2.
// Go reference: server/stream.go:365 (AllowMsgCounter field)
public bool AllowMsgCounter { get; set; }
// Go: StreamConfig.AllowAtomicPublish — enables atomic batch publishing.
// Added in v2.12, requires API level 2.
// Go reference: server/stream.go:367 (AllowAtomicPublish field)
public bool AllowAtomicPublish { get; set; }
// Go: StreamConfig.PersistMode — async vs sync storage persistence.
// AsyncPersistMode requires API level 2.
// Go reference: server/stream.go:375 (PersistMode field)
public PersistMode PersistMode { get; set; } = PersistMode.Sync;
// Go: StreamConfig.Metadata — user-supplied and server-managed key/value metadata.
// The server automatically sets _nats.req.level, _nats.ver, _nats.level.
// Go reference: server/stream.go:380 (Metadata field)
public Dictionary<string, string>? Metadata { get; set; }
}
/// <summary>
/// Persistence mode for the stream.
/// Go reference: server/stream.go — AsyncPersistMode constant.
/// </summary>
public enum PersistMode
{
Sync = 0,
Async = 1,
}
public enum StorageType