public Task <long> AddAllAsync <TE>(ICollection <TE> collection, OverflowPolicy overflowPolicy) where TE : T { ValidationUtil.ThrowExceptionIfTrue(collection.Count == 0, "Collection cannot be empty"); var valueList = ToDataList(collection); var request = RingbufferAddAllCodec.EncodeRequest(GetName(), valueList, (int)overflowPolicy); return(InvokeAsync(request, GetPartitionKey(), m => RingbufferAddAllCodec.DecodeResponse(m).response)); }
public Task <IList <T> > ReadManyAsync(long startSequence, int minCount, int maxCount) { CheckSequence(startSequence); ValidationUtil.ThrowExceptionIfTrue(minCount < 0, "minCount can't be smaller than 0"); ValidationUtil.ThrowExceptionIfTrue(maxCount < minCount, "maxCount should be equal or larger than minCount"); ValidationUtil.ThrowExceptionIfTrue(minCount > Capacity(), "the minCount should be smaller than or equal to the capacity"); ValidationUtil.ThrowExceptionIfTrue(maxCount > MaxBatchSize, "maxCount can't be larger than " + MaxBatchSize); var request = RingbufferReadManyCodec.EncodeRequest(GetName(), startSequence, minCount, maxCount, null); return(InvokeAsync(request, GetPartitionKey(), m => ToList <T>(RingbufferReadManyCodec.DecodeResponse(m).items))); }