Method ReserveAsync
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
ReserveAsync(long, CancellationToken)
Reserves room for one payload, waiting until the budget has it.
public Task<RawMimeMemoryReservation> ReserveAsync(long bytes, CancellationToken cancellationToken)
Parameters
byteslongHow many bytes the caller is about to hold.
cancellationTokenCancellationTokenAbandons the wait; a reservation already granted is unaffected.
Returns
- Task<RawMimeMemoryReservation>
The reservation, which returns its bytes to the budget when it is disposed.
Exceptions
- ArgumentOutOfRangeException
Thrown when
bytesis not positive or exceeds CapacityBytes, which no wait could ever satisfy.- OperationCanceledException
Thrown when the caller cancelled before the budget had room.