From 61049408dc3380df20b145f05cf74a5b29d0e129 Mon Sep 17 00:00:00 2001 From: Kathryn Baldauf Date: Thu, 16 Oct 2025 14:03:23 -0700 Subject: [PATCH] Make some image/mounting related functions public (#335) Make some image/mounting related functions public for use outside of this repo Signed-off-by: Kathryn Baldauf --- Sources/Containerization/AttachedFilesystem.swift | 7 +++++++ Sources/Containerization/Hash.swift | 2 +- Sources/Containerization/Image/ImageStore/ImageStore.swift | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Sources/Containerization/AttachedFilesystem.swift b/Sources/Containerization/AttachedFilesystem.swift index 0e85132b..ebe42ab5 100644 --- a/Sources/Containerization/AttachedFilesystem.swift +++ b/Sources/Containerization/AttachedFilesystem.swift @@ -45,4 +45,11 @@ public struct AttachedFilesystem: Sendable { self.destination = mount.destination } #endif + + public init(type: String, source: String, destination: String, options: [String]) { + self.type = type + self.source = source + self.destination = destination + self.options = options + } } diff --git a/Sources/Containerization/Hash.swift b/Sources/Containerization/Hash.swift index 87a1de8c..57c9dd64 100644 --- a/Sources/Containerization/Hash.swift +++ b/Sources/Containerization/Hash.swift @@ -19,7 +19,7 @@ import Crypto import ContainerizationError -func hashMountSource(source: String) throws -> String { +public func hashMountSource(source: String) throws -> String { guard let data = source.data(using: .utf8) else { throw ContainerizationError(.invalidArgument, message: "\(source) could not be converted to Data") } diff --git a/Sources/Containerization/Image/ImageStore/ImageStore.swift b/Sources/Containerization/Image/ImageStore/ImageStore.swift index 8d35068e..573a9ad3 100644 --- a/Sources/Containerization/Image/ImageStore/ImageStore.swift +++ b/Sources/Containerization/Image/ImageStore/ImageStore.swift @@ -103,7 +103,7 @@ extension ImageStore { /// - Note: It is assumed that the underlying manifests and blob layers for the image already exists in the `ContentStore` that the `ImageStore` was initialized with. This method is invoked when the `pull(...)` , `load(...)` and `tag(...)` methods are used. /// - Returns: A `Containerization.Image` @discardableResult - internal func create(description: Image.Description) async throws -> Image { + public func create(description: Image.Description) async throws -> Image { try await self.lock.withLock { ctx in try await self._create(description: description, lock: ctx) }