Closed sebastienros closed 2 years ago
Thanks Seb, yeah I can see that it is quite some work... So as I said in the issue above:
It would require to duplicate the interface and implement all the Async methods
I would prefer that we introduce a new IFileSystemAsync
interface and let the existing implementation redirect the new XXXAsync
methods to their sync counterpart. This should be possible to do that on the base class without having to rewrite for everything.
Also, today, none of the .NET API (and so Win32 APIs) exposed by IFileSystem
are providing Async alternatives, so it would be mostly for remote IFileSystem
scenarios.
Fixes https://github.com/xoofx/zio/issues/53
I gave it a try to convert anything that would require async. I didn't go with duplicating methods. All tests pass, if not run concurrently ;) there must be some wrong locking of maybe I missed an await and some race condition happens. Running groups of them work fine.
Hopefully it gives an idea of the required changes, and the usage. Would be a major version bump, losing .NET 4.0 target too. I decided to not use the 'Async' suffix has it made less work, but I would suggest to add it.
I hope someone will try and improve it to fix the concurrency issues, but I won't be offended if you close the PR, I don't think I will put up much time on it, though didn't want to go to waste either.