Since a reference to the IndexVolumeWriter is passed to the
FileEntryItem, we should not dispose of it here.
This reverts commit b6123cc156.
This is a potential fix for issue #4130.
In code the throttling generally works backwards than what one would expect.
The streams that are throttled are the streams that operate on files from the local machine.
This fixes the download throttling not working and the upload throttling applying to
both uploads and downloads.
When doing a Put operation the stream on the local machine is reading from the
local filesystem and hence the upload throttle bytes per second needs to be
applied to the reading of the stream, not the writing.
Similarly when doing a Get operation the download throttle bytes per second needs
to be applied to the writing of the stream.
Fixes#4115
The list folder was not being written to dindex files when performing a
compact operation. After the data blocks have been moved to a new volume
and the new volume data is finished being written to the new index file,
read the blocklists from the database and write them to the new index
file.
The InnerException property of an AggregateException can be another
AggregateException. By calling Flatten(), we remove inner
AggregateExceptions so that the InnerExceptions property contains all
the original exceptions. The InnerException property is the first
element of InnerExceptions.
If one of these fields is accidentally reassigned, it's possible for
threads to be oblivious to an existing lock. By making the fields
readonly, we will be notified at compile-time if we inadvertently
redefine one of these fields.
By changing to IEnumerable, it is possible to iterate only a portion of the list, which is useful when not all entries are needed (e.g., when testing a connection).
All existing backends have been updated, and any which were able to be changed to yield return results in a straightforward way now do.
Many backends had a try/catch in the List() method. Due to the fact that yield returns can't be placed within a try/catch block, these have been refactored to either scope the try/catch to the parts that (should) be the only places throwing exceptions, so that exceptions are still caught and handled.
Note that lazy evaluation may cause some changes in behavior - exceptions that were previously thrown at the point of invokation of List() may now be thrown while it is being enumerated.
I believe this will not be problematic though, as the only well-known exception seems to be FolderMissingException, which should be thrown by Test(), but TestList() attempts to enumerate the list to force this exception.
Any places that require the legacy behavior can get it by simply converting the lazy enumerable to a List()