feat(batch15): complete msgblock and consumer file store port
This commit is contained in:
@@ -69,6 +69,22 @@ public static class StoreEnumExtensions
|
||||
};
|
||||
}
|
||||
|
||||
public static (byte[]? Buffer, Exception? Error) Decompress(this StoreCompression alg, byte[] buf)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(buf);
|
||||
|
||||
const int checksumSize = FileStoreDefaults.RecordHashSize;
|
||||
if (buf.Length < checksumSize)
|
||||
return (null, new InvalidDataException("compressed buffer is too short"));
|
||||
|
||||
return alg switch
|
||||
{
|
||||
StoreCompression.NoCompression => (buf, null),
|
||||
StoreCompression.S2Compression => DecompressS2(buf, checksumSize),
|
||||
_ => (null, new InvalidOperationException("compression algorithm not known")),
|
||||
};
|
||||
}
|
||||
|
||||
private static (byte[]? Buffer, Exception? Error) CompressS2(byte[] buf, int checksumSize)
|
||||
{
|
||||
try
|
||||
@@ -86,4 +102,22 @@ public static class StoreEnumExtensions
|
||||
return (null, new IOException("error writing to compression writer", ex));
|
||||
}
|
||||
}
|
||||
|
||||
private static (byte[]? Buffer, Exception? Error) DecompressS2(byte[] buf, int checksumSize)
|
||||
{
|
||||
try
|
||||
{
|
||||
var bodyLength = buf.Length - checksumSize;
|
||||
var decompressedBody = Snappy.Decode(buf.AsSpan(0, bodyLength));
|
||||
|
||||
var output = new byte[decompressedBody.Length + checksumSize];
|
||||
Buffer.BlockCopy(decompressedBody, 0, output, 0, decompressedBody.Length);
|
||||
Buffer.BlockCopy(buf, bodyLength, output, decompressedBody.Length, checksumSize);
|
||||
return (output, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return (null, new IOException("error reading compression reader", ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
porting.db
BIN
porting.db
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
# NATS .NET Porting Status Report
|
||||
|
||||
Generated: 2026-02-28 23:34:28 UTC
|
||||
Generated: 2026-02-28 23:39:18 UTC
|
||||
|
||||
## Modules (12 total)
|
||||
|
||||
@@ -13,10 +13,10 @@ Generated: 2026-02-28 23:34:28 UTC
|
||||
| Status | Count |
|
||||
|--------|-------|
|
||||
| complete | 22 |
|
||||
| deferred | 1698 |
|
||||
| deferred | 1697 |
|
||||
| n_a | 24 |
|
||||
| stub | 1 |
|
||||
| verified | 1928 |
|
||||
| verified | 1929 |
|
||||
|
||||
## Unit Tests (3257 total)
|
||||
|
||||
@@ -35,4 +35,4 @@ Generated: 2026-02-28 23:34:28 UTC
|
||||
|
||||
## Overall Progress
|
||||
|
||||
**3601/6942 items complete (51.9%)**
|
||||
**3602/6942 items complete (51.9%)**
|
||||
|
||||
Reference in New Issue
Block a user