From c2e22192d484a247acbafacaabb7b148acea593e Mon Sep 17 00:00:00 2001 From: Aditya Ramani Date: Wed, 4 Jun 2025 18:47:58 -0700 Subject: [PATCH] Fix compiler warning in LocalOCILayoutClient (#19) Resolves the warning ``` LocalOCILayoutClient.swift:87:37: warning: capture of non-sendable type 'T.AsyncIterator.Type' in an isolated closure 87 | for try await buffer in input { | `- warning: capture of non-sendable type 'T.AsyncIterator.Type' in an isolated closure 88 | wrote += buffer.readableBytes 89 | try buffer.withUnsafeReadableBytes { pointer in ``` Signed-off-by: Aditya Ramani --- .../ContainerizationOCI/Client/LocalOCILayoutClient.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/ContainerizationOCI/Client/LocalOCILayoutClient.swift b/Sources/ContainerizationOCI/Client/LocalOCILayoutClient.swift index 4a799011..1489aeef 100644 --- a/Sources/ContainerizationOCI/Client/LocalOCILayoutClient.swift +++ b/Sources/ContainerizationOCI/Client/LocalOCILayoutClient.swift @@ -73,7 +73,8 @@ package final class LocalOCILayoutClient: ContentClient { ) async throws where T.Element == ByteBuffer { let input = try streamGenerator() - try await self.cs.ingest { dir in + let (id, dir) = try await self.cs.newIngestSession() + do { let into = dir.appendingPathComponent(descriptor.digest.trimmingDigestPrefix) guard FileManager.default.createFile(atPath: into.path, contents: nil) else { throw Error.cannotCreateFile @@ -96,6 +97,9 @@ package final class LocalOCILayoutClient: ContentClient { } } } + try await self.cs.completeIngestSession(id) + } catch { + try await self.cs.cancelIngestSession(id) } } }