feat(filestore): implement EncodedStreamState, UpdateConfig, ResetState, fix Delete signature
Complete IStreamStore Batch 2 — all remaining interface methods now have FileStore implementations: - EncodedStreamState: placeholder returning empty (full codec in Task 9) - UpdateConfig: no-op placeholder for config hot-reload - ResetState: no-op (state derived from blocks on construction) - Delete(bool): now calls Stop() first and matches interface signature
This commit is contained in:
@@ -678,9 +678,9 @@ public sealed class FileStore : IStreamStore, IAsyncDisposable, IDisposable
|
||||
/// Stops the store and deletes all persisted data (blocks, index files).
|
||||
/// Reference: golang/nats-server/server/filestore.go — fileStore.Delete.
|
||||
/// </summary>
|
||||
public void Delete()
|
||||
public void Delete(bool inline = false)
|
||||
{
|
||||
DisposeAllBlocks();
|
||||
Stop();
|
||||
if (Directory.Exists(_options.Directory))
|
||||
{
|
||||
try { Directory.Delete(_options.Directory, recursive: true); }
|
||||
@@ -1752,6 +1752,33 @@ public sealed class FileStore : IStreamStore, IAsyncDisposable, IDisposable
|
||||
DisposeAllBlocks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a binary-encoded snapshot of the stream state. The <paramref name="failed"/>
|
||||
/// parameter indicates the number of failed apply operations (passed through for
|
||||
/// cluster consensus use). Currently returns an empty array — the full binary
|
||||
/// encoding will be added when the RAFT snapshot codec is implemented (Task 9).
|
||||
/// Reference: golang/nats-server/server/filestore.go — EncodedStreamState.
|
||||
/// </summary>
|
||||
public byte[] EncodedStreamState(ulong failed) => [];
|
||||
|
||||
/// <summary>
|
||||
/// Updates the stream configuration. Currently a no-op placeholder — config
|
||||
/// changes that affect storage (MaxMsgsPer, MaxAge, etc.) will be enforced
|
||||
/// when the stream engine is fully wired.
|
||||
/// Reference: golang/nats-server/server/filestore.go — UpdateConfig.
|
||||
/// </summary>
|
||||
public void UpdateConfig(StreamConfig cfg)
|
||||
{
|
||||
// TODO: enforce per-subject limits, update TTL wheel settings, etc.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets internal cached state after a leadership transition or snapshot restore.
|
||||
/// Currently a no-op — the FileStore re-derives its state from blocks on construction.
|
||||
/// Reference: golang/nats-server/server/filestore.go — ResetState.
|
||||
/// </summary>
|
||||
public void ResetState() { }
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ConsumerStore factory
|
||||
// Reference: golang/nats-server/server/filestore.go — fileStore.ConsumerStore
|
||||
|
||||
Reference in New Issue
Block a user