public DtoChannel(IChannel channel, ITypeSerializerMappingFactory mappingFactory) { _channel = channel; _receivingMapping = mappingFactory.CreateMapping(); _sendingMapping = mappingFactory.CreateMapping(); _channel.OnReceive.Subscribe(new Receiver(this)); }
public ReadOnlyEventStore(IEventFileStorage file, ITypeSerializersMapping mapping, ICompressionStrategy compressionStrategy) { File = file; Mapping = mapping; CompressionStrategy = compressionStrategy; EndBufferPosition = ulong.MaxValue; MaxBlockSize = Math.Min(File.MaxBlockSize, 0x1000000); // For Length there is only 3 bytes so maximum could be less if (MaxBlockSize < FirstReadAhead) throw new ArgumentException("file.MaxBlockSize is less than FirstReadAhead"); }
public ReadOnlyEventStore(IEventFileStorage file, ITypeSerializersMapping mapping, ICompressionStrategy compressionStrategy) { File = file; Mapping = mapping; CompressionStrategy = compressionStrategy; EndBufferPosition = ulong.MaxValue; MaxBlockSize = Math.Min(File.MaxBlockSize, 0x1000000); // For Length there is only 3 bytes so maximum could be less if (MaxBlockSize < FirstReadAhead) { throw new ArgumentException("file.MaxBlockSize is less than FirstReadAhead"); } }
void TestSerialization(object value) { var writer = new SpanWriter(); var storedDescriptorCtx = _mapping.StoreNewDescriptors(value); storedDescriptorCtx.FinishNewDescriptors(ref writer); storedDescriptorCtx.StoreObject(ref writer, value); storedDescriptorCtx.CommitNewDescriptors(); var reader = new SpanReader(writer.GetSpan()); _mapping.LoadTypeDescriptors(ref reader); Assert.Equal(value, _mapping.LoadObject(ref reader)); Assert.True(reader.Eof); _mapping = _ts.CreateMapping(); reader = new SpanReader(writer.GetSpan()); _mapping.LoadTypeDescriptors(ref reader); Assert.Equal(value, _mapping.LoadObject(ref reader)); Assert.True(reader.Eof); }
public TypeSerializersTest() { _ts = new TypeSerializers(); _mapping = _ts.CreateMapping(); }
public AppendingEventStore(IEventFileStorage file, ITypeSerializersMapping mapping, ICompressionStrategy compressionStrategy) : base(file, mapping, compressionStrategy) { }