| 34 | } |
| 35 | |
| 36 | internal sealed class ForySerializer<TWrite, TRead> : IBenchmarkSerializer<TWrite> |
| 37 | { |
| 38 | private readonly ForyRuntime _writer = ForyRuntime.Builder().Compatible(true).Build(); |
| 39 | private readonly ForyRuntime _reader = ForyRuntime.Builder().Compatible(true).Build(); |
| 40 | |
| 41 | public ForySerializer(bool schemaMismatch) |
| 42 | { |
| 43 | BenchmarkTypeRegistry.RegisterAll(_writer); |
| 44 | if (schemaMismatch) |
| 45 | { |
| 46 | BenchmarkTypeRegistry.RegisterAllV2(_reader); |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | BenchmarkTypeRegistry.RegisterAll(_reader); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | public string Name => "fory"; |
| 55 | |
| 56 | public byte[] Serialize(TWrite value) |
| 57 | { |
| 58 | return _writer.Serialize(value); |
| 59 | } |
| 60 | |
| 61 | public object? Deserialize(byte[] payload) |
| 62 | { |
| 63 | return _reader.Deserialize<TRead>(payload); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | internal static class BenchmarkTypeRegistry |
| 68 | { |
nothing calls this directly
no test coverage detected