예제 #1
0
 public DtoChannel(IChannel channel, ITypeSerializerMappingFactory mappingFactory)
 {
     _channel          = channel;
     _receivingMapping = mappingFactory.CreateMapping();
     _sendingMapping   = mappingFactory.CreateMapping();
     _channel.OnReceive.Subscribe(new Receiver(this));
 }
예제 #2
0
 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");
 }
예제 #3
0
 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");
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
 public TypeSerializersTest()
 {
     _ts      = new TypeSerializers();
     _mapping = _ts.CreateMapping();
 }
예제 #6
0
 public AppendingEventStore(IEventFileStorage file, ITypeSerializersMapping mapping, ICompressionStrategy compressionStrategy)
     : base(file, mapping, compressionStrategy)
 {
 }
예제 #7
0
 public AppendingEventStore(IEventFileStorage file, ITypeSerializersMapping mapping, ICompressionStrategy compressionStrategy)
     : base(file, mapping, compressionStrategy)
 {
 }