using System; using System.Threading.Tasks; using ZeroLevel.Services.PartitionStorage.Interfaces; using ZeroLevel.Services.Serialization; namespace ZeroLevel.Services.PartitionStorage { public record DeserializeResult(bool Success, T Value); public delegate Task> TryDeserializeMethod(MemoryStreamReader reader); public sealed class StoreSerializers : IStoreSerializer { private readonly Func _keySerializer; private readonly Func _inputSerializer; private readonly Func _valueSerializer; private readonly Func>> _keyDeserializer; private readonly Func>> _inputDeserializer; private readonly Func>> _valueDeserializer; public StoreSerializers( Func keySerializer, Func inputSerializer, Func valueSerializer, Func>> keyDeserializer, Func>> inputDeserializer, Func>> valueDeserializer) { _keySerializer = keySerializer; _inputSerializer = inputSerializer; _valueSerializer = valueSerializer; _keyDeserializer = keyDeserializer; _inputDeserializer = inputDeserializer; _valueDeserializer = valueDeserializer; } public Func KeySerializer => _keySerializer; public Func InputSerializer => _inputSerializer; public Func ValueSerializer => _valueSerializer; public Func>> KeyDeserializer => _keyDeserializer; public Func>> InputDeserializer => _inputDeserializer; public Func>> ValueDeserializer => _valueDeserializer; } }