From d9e91dfb241627379d7ece43e2c7072efcc20473 Mon Sep 17 00:00:00 2001 From: Anthony DePasquale Date: Tue, 10 Feb 2026 11:56:51 +0000 Subject: [PATCH 1/2] Add release method to ContainerManager Decompose delete() into release() + file removal. The new release() method frees network resources for a container without deleting its files, enabling stop-and-restart workflows that preserve the rootfs. --- Sources/Containerization/ContainerManager.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sources/Containerization/ContainerManager.swift b/Sources/Containerization/ContainerManager.swift index 77c43b93..693df01c 100644 --- a/Sources/Containerization/ContainerManager.swift +++ b/Sources/Containerization/ContainerManager.swift @@ -448,10 +448,17 @@ public struct ContainerManager: Sendable { } } - /// Performs the cleanup of a container. + /// Releases network resources for a container. + /// /// - Parameter id: The container ID. - public mutating func delete(_ id: String) throws { + public mutating func release(_ id: String) throws { try self.network?.release(id) + } + + /// Releases network resources and removes all files for a container. + /// - Parameter id: The container ID. + public mutating func delete(_ id: String) throws { + try self.release(id) let path = containerRoot.appendingPathComponent(id) try FileManager.default.removeItem(at: path) } From 43a3b25556fac2c55d977b1dad6a8cee7b397652 Mon Sep 17 00:00:00 2001 From: Anthony DePasquale Date: Wed, 11 Feb 2026 11:20:38 +0100 Subject: [PATCH 2/2] Rename release to releaseNetwork --- Sources/Containerization/ContainerManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Containerization/ContainerManager.swift b/Sources/Containerization/ContainerManager.swift index 693df01c..099eef49 100644 --- a/Sources/Containerization/ContainerManager.swift +++ b/Sources/Containerization/ContainerManager.swift @@ -451,14 +451,14 @@ public struct ContainerManager: Sendable { /// Releases network resources for a container. /// /// - Parameter id: The container ID. - public mutating func release(_ id: String) throws { + public mutating func releaseNetwork(_ id: String) throws { try self.network?.release(id) } /// Releases network resources and removes all files for a container. /// - Parameter id: The container ID. public mutating func delete(_ id: String) throws { - try self.release(id) + try self.releaseNetwork(id) let path = containerRoot.appendingPathComponent(id) try FileManager.default.removeItem(at: path) }