Skip to content

Commit f90eca9

Browse files
authored
Merge pull request #43 from rameel/deprecate-zipfs
Deprecate ZipFileSystem due to thread safety limitations
2 parents c758f2b + 8ea22ef commit f90eca9

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/Ramstack.FileSystem.Zip/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44

55
Provides an implementation of `Ramstack.FileSystem` based on ZIP archives.
66

7+
> [!CAUTION]
8+
> The `ZipFileSystem` is **not thread-safe** and allows reading only one file at a time, as it relies on `ZipArchive`,
9+
> which does not support parallel read operations or simultaneous opening of multiple streams.
10+
11+
> [!WARNING]
12+
> Due to this limitation, the `ZipFileSystem` class is marked as `[Obsolete]`.
13+
14+
> [!IMPORTANT]
15+
> You may use `ZipFileSystem` only if you can guarantee that:
16+
> - Only one file is open for reading at a time.
17+
> - No file is accessed concurrently.
18+
719
## Getting Started
820

921
To install the `Ramstack.FileSystem.Zip` [NuGet package](https://www.nuget.org/packages/Ramstack.FileSystem.Zip)

src/Ramstack.FileSystem.Zip/ZipFileSystem.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ namespace Ramstack.FileSystem.Zip;
77
/// <summary>
88
/// Represents a file system backed by a ZIP archive.
99
/// </summary>
10+
/// <remarks>
11+
/// <b>WARNING:</b>
12+
/// <para>
13+
/// The <see cref="ZipFileSystem"/> is not thread-safe and allows reading only one file at a time, as it relies on
14+
/// <see cref="ZipArchive"/>, which does not support parallel read operations or simultaneous opening of multiple streams.
15+
/// </para>
16+
/// <para>
17+
/// You may use this class only if you can guarantee that:
18+
/// <list type="bullet">
19+
/// <item><description>Only one file is open for reading at a time.</description></item>
20+
/// <item><description>No file is accessed concurrently.</description></item>
21+
/// </list>
22+
/// </para>
23+
/// </remarks>
24+
[Obsolete("Deprecated due to thread safety limitations and parallel file access capabilities.")]
1025
public sealed class ZipFileSystem : IVirtualFileSystem
1126
{
1227
private readonly ZipArchive _archive;

0 commit comments

Comments
 (0)