public FrameFormatterSerializationOptions(int totWorkerThreads, bool throwOnUnnasignedFrameDeserialization = true)
 {
     BatchSizeEstimatorConfig = new BatchSizeEstimatorConfig();
     FIFOWorkerConfig         = new FIFOWorkerConfig(totWorkerThreads);
     MthWorkerConfig          = new MultiThreadedWorkerConfig(totWorkerThreads);
     ThrowOnUnnasignedFrameDeserialization = throwOnUnnasignedFrameDeserialization;
 }
 public FrameFormatterSerializationOptions(
     BatchSizeEstimatorConfig batchSizeEstimatorConfig,
     MultiThreadedWorkerConfig mthWorkerConfig,
     bool throwOnUnnasignedFrameDeserialization = true)
 {
     BatchSizeEstimatorConfig = batchSizeEstimatorConfig;
     FIFOWorkerConfig         = new FIFOWorkerConfig(Environment.ProcessorCount * 2);
     MthWorkerConfig          = mthWorkerConfig;
     ThrowOnUnnasignedFrameDeserialization = throwOnUnnasignedFrameDeserialization;
 }
 public FrameFormatterSerializationOptions(
     BatchSizeEstimatorConfig batchSizeEstimatorConfig,
     FIFOWorkerConfig fIFOWorkerConfig,
     MultiThreadedWorkerConfig mthWorkerConfig,
     bool throwOnUnnasignedFrameDeserialization = true)
 {
     BatchSizeEstimatorConfig = batchSizeEstimatorConfig;
     FIFOWorkerConfig         = fIFOWorkerConfig;
     MthWorkerConfig          = mthWorkerConfig;
     ThrowOnUnnasignedFrameDeserialization = throwOnUnnasignedFrameDeserialization;
 }
Ejemplo n.º 4
0
 public CollectionSerializerAsync(Stream stream, FIFOWorkerConfig fifowConfig, BatchSizeEstimatorConfig estimatorConfig, TypeModel typeModel)
 {
     this.stream    = stream;
     fifow          = new FIFOWorker <List <T>, MemoryStream>(fifowConfig, HandleWorkerOutput);
     this.typeModel = typeModel;
     typeModel.SetupParallelServices <T>();
     batchEstimator      = new BatchSizeEstimator(estimatorConfig);
     objPoolList         = new DefaultObjectPool <List <T> >(new ListObjectPoolPolicy <T>(64), fifowConfig.MaxQueuedItems);
     objPoolMemoryStream = new DefaultObjectPool <MemoryStream>(
         new MemoryStreamObjectPoolPolicy(Math.Max(1024 * 64, estimatorConfig.DesiredBatchSize_bytes)),
         fifowConfig.MaxQueuedItems);
     desiredBatchSize = 1;
     currentBatch     = objPoolList.Get();
 }
 public CollectionSerializerAsync(Stream stream, FIFOWorkerConfig fifowConfig, BatchSizeEstimatorConfig estimatorConfig, MessagePackSerializerOptions w_opts)
 {
     this.stream               = stream;
     fifow                     = new FIFOWorker <ArrayPoolBufferWriter <T>, BatchWithBufferWriters>(fifowConfig, HandleWorkerOutput);
     batchEstimator            = new BatchSizeEstimator(estimatorConfig);
     this.w_opts               = w_opts;
     objPoolBufferWriterBodies = new DefaultObjectPool <ArrayPoolBufferWriter <byte> >(
         new ArrayPoolBufferWriterObjectPoolPolicy <byte>(Math.Max(1024 * 64, estimatorConfig.DesiredBatchSize_bytes)),
         fifowConfig.MaxQueuedItems);
     objPoolBufferWriterBodyLengths = new DefaultObjectPool <ArrayPoolBufferWriter <int> >(
         new ArrayPoolBufferWriterObjectPoolPolicy <int>(1024),
         fifowConfig.MaxQueuedItems);
     objPoolOutputBatch = new DefaultObjectPool <ArrayPoolBufferWriter <T> >(
         new ArrayPoolBufferWriterObjectPoolPolicy <T>(1024),
         fifowConfig.MaxQueuedItems);
     currentBatch     = objPoolOutputBatch.Get();
     desiredBatchSize = 1;
     formatterT       = w_opts.Resolver.GetFormatterWithVerify <T>();
 }
 public CollectionSerializerAsync(Stream stream, FIFOWorkerConfig fifowConfig, BatchSizeEstimatorConfig estimatorConfig) :
     this(stream, fifowConfig, estimatorConfig, MessagePackSerializerOptions.Standard)
 {
 }