Port Go filestore tombstone/deletion tests, consumer state encode/decode, consumer file store persistence, and message TTL enforcement. Adds ConsumerStateCodec and ConsumerFileStore implementations. 17 new tests ported from filestore_test.go.
30 lines
1.4 KiB
C#
30 lines
1.4 KiB
C#
namespace NATS.Server.JetStream.Storage;
|
|
|
|
public sealed class FileStoreOptions
|
|
{
|
|
public string Directory { get; set; } = string.Empty;
|
|
public int BlockSizeBytes { get; set; } = 64 * 1024;
|
|
public string IndexManifestFileName { get; set; } = "index.manifest.json";
|
|
public int MaxAgeMs { get; set; }
|
|
|
|
// Legacy boolean compression / encryption flags (FSV1 envelope format).
|
|
// When set and the corresponding enum is left at its default (NoCompression /
|
|
// NoCipher), the legacy Deflate / XOR path is used for backward compatibility.
|
|
public bool EnableCompression { get; set; }
|
|
public bool EnableEncryption { get; set; }
|
|
|
|
public bool EnablePayloadIntegrityChecks { get; set; } = true;
|
|
public byte[]? EncryptionKey { get; set; }
|
|
|
|
// Go parity: StoreCompression / StoreCipher (filestore.go ~line 91-92).
|
|
// When Compression == S2Compression the S2/Snappy codec is used (FSV2 envelope).
|
|
// When Cipher != NoCipher an AEAD cipher is used instead of the legacy XOR.
|
|
// Enums are defined in AeadEncryptor.cs.
|
|
public StoreCompression Compression { get; set; } = StoreCompression.NoCompression;
|
|
public StoreCipher Cipher { get; set; } = StoreCipher.NoCipher;
|
|
|
|
// Go: StreamConfig.MaxMsgsPer — maximum messages per subject (1 = keep last per subject).
|
|
// Reference: golang/nats-server/server/filestore.go — per-subject message limits.
|
|
public int MaxMsgsPerSubject { get; set; }
|
|
}
|