internal Spooler(IStateManager stateManager, Bookmark bookmark, int batchSize = 1)
 {
     _stateManager  = stateManager;
     _transactionId = bookmark.TransactionId;
     _keys          = new SpoolerKeyCollection(_transactionId, bookmark.TotalCount);
     _workItems     = bookmark.TotalCount;
     BatchSize      = batchSize;
     readIndices    = bookmark.Indices.ToList();
 }
 private Spooler(IStateManager stateManager, TIn[] inputs, Func <TIn, Task <TOut> > process, Converter <SpoolerResult <TIn, TOut>, TResult> outputConverter, int batchSize = 1)
 {
     _stateManager    = stateManager;
     _transactionId   = Guid.NewGuid().ToString();
     _inputs          = inputs;
     _process         = process;
     _outputConverter = outputConverter;
     _workItems       = inputs.Length;
     _keys            = new SpoolerKeyCollection(_transactionId, inputs.Length);
     BatchSize        = BatchSize;
     readIndices      = new List <int>();
 }