mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Add a NIOFilePath based NIOFileSystem (#3363)
Motivation: We changed the file path type in `_NIOFileSystem` to use `NIOFilePath` instead of `FilePath`. Originally we planned to use API shims to avoid breaking API, however in some cases this was inevitable (i.e. where a file path is returned to the caller). To roll over to the new API we will instead introduce the `NIOFileSystem` module using `NIOFilePath` and have `_NIOFileSystem` use `FilePath`. Users can then opt-in to the new stable API rather than having it forced upon them. The first wave of these changes turns `_NIOFileSystem` into `NIOFileSystem` and uses `NIOFilePath` for its APIs. Modifications: - Remove disfavoured overloads (i.e. `FilePath` APIs) - Update the `DirectoryEntry` API to use `NIOFilePath`. - Update tests to use `NIOFilePath` since many were relying on the newly removed shims - Remove the underscore from the module names and products - Remove deprecated methods A follow up change will re-instate the `_NIOFileSystem` (and compat) module and products using `FilePath`. Result: `NIOFileSystem` has a stable API.
This commit is contained in:
1 parent
5bf5054a83
commit
7290551b7f
54 files changed
+234
-1514
No files matched your search
@@ -37,21 +37,6 @@ extension ArraySlice where Element == UInt8 {
|
||||
self = Self(bytes)
|
||||
}
|
||||
|
||||
/// Reads the contents of the file at the path.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - path: The path of the file to read.
|
||||
/// - maximumSizeAllowed: The maximum size of file which can be read, in bytes, as a ``ByteCount``.
|
||||
/// - fileSystem: The ``FileSystemProtocol`` instance to use to read the file.
|
||||
@_disfavoredOverload
|
||||
public init(
|
||||
contentsOf path: FilePath,
|
||||
maximumSizeAllowed: ByteCount,
|
||||
fileSystem: some FileSystemProtocol
|
||||
) async throws {
|
||||
try await self.init(contentsOf: .init(path), maximumSizeAllowed: maximumSizeAllowed, fileSystem: fileSystem)
|
||||
}
|
||||
|
||||
/// Reads the contents of the file at the path using ``FileSystem``.
|
||||
///
|
||||
/// - Parameters:
|
||||
@@ -67,18 +52,5 @@ extension ArraySlice where Element == UInt8 {
|
||||
fileSystem: .shared
|
||||
)
|
||||
}
|
||||
|
||||
/// Reads the contents of the file at the path using ``FileSystem``.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - path: The path of the file to read.
|
||||
/// - maximumSizeAllowed: The maximum size of file which can be read, as a ``ByteCount``.
|
||||
@_disfavoredOverload
|
||||
public init(
|
||||
contentsOf path: FilePath,
|
||||
maximumSizeAllowed: ByteCount
|
||||
) async throws {
|
||||
try await self.init(contentsOf: .init(path), maximumSizeAllowed: maximumSizeAllowed)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user