Skip to content

Commit f3641e6

Browse files
authored
Undo accidental revert of commits (#289)
#288 accidentally reverted #282 and #284.
1 parent 5fbae0e commit f3641e6

File tree

8 files changed

+16
-13
lines changed

8 files changed

+16
-13
lines changed

Sources/Containerization/ContainerManager.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public struct ContainerManager: Sendable {
4545
@available(macOS 26.0, *)
4646
public struct VmnetNetwork: Network {
4747
private var allocator: Allocator
48+
// `reference` isn't used concurrently.
4849
nonisolated(unsafe) private let reference: vmnet_network_ref
4950

5051
/// The IPv4 subnet of this network.
@@ -94,6 +95,7 @@ public struct ContainerManager: Sendable {
9495
public let gateway: String?
9596
public let macAddress: String?
9697

98+
// `reference` isn't used concurrently.
9799
nonisolated(unsafe) private let reference: vmnet_network_ref
98100

99101
public init(
@@ -478,9 +480,4 @@ extension CIDRAddress {
478480
}
479481
}
480482

481-
@available(macOS 26.0, *)
482-
private struct SendableReference: Sendable {
483-
nonisolated(unsafe) private let reference: vmnet_network_ref
484-
}
485-
486483
#endif

Sources/Containerization/Image/ImageStore/ImageStore+Export.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import Crypto
2424
import Foundation
2525

2626
extension ImageStore {
27-
internal struct ExportOperation {
27+
public struct ExportOperation: Sendable {
2828
let name: String
2929
let tag: String
3030
let contentStore: ContentStore
3131
let client: ContentClient
3232
let progress: ProgressHandler?
3333

34-
init(name: String, tag: String, contentStore: ContentStore, client: ContentClient, progress: ProgressHandler? = nil) {
34+
public init(name: String, tag: String, contentStore: ContentStore, client: ContentClient, progress: ProgressHandler? = nil) {
3535
self.contentStore = contentStore
3636
self.client = client
3737
self.progress = progress
@@ -40,7 +40,7 @@ extension ImageStore {
4040
}
4141

4242
@discardableResult
43-
internal func export(index: Descriptor, platforms: (Platform) -> Bool) async throws -> Descriptor {
43+
public func export(index: Descriptor, platforms: (Platform) -> Bool) async throws -> Descriptor {
4444
var pushQueue: [[Descriptor]] = []
4545
var current: [Descriptor] = [index]
4646
while !current.isEmpty {

Sources/Containerization/Image/ImageStore/ImageStore+Import.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import ContainerizationOCI
2222
import Foundation
2323

2424
extension ImageStore {
25-
internal struct ImportOperation {
25+
public struct ImportOperation: Sendable {
2626
static let decoder = JSONDecoder()
2727

2828
let client: ContentClient
@@ -31,7 +31,7 @@ extension ImageStore {
3131
let progress: ProgressHandler?
3232
let name: String
3333

34-
init(name: String, contentStore: ContentStore, client: ContentClient, ingestDir: URL, progress: ProgressHandler? = nil) {
34+
public init(name: String, contentStore: ContentStore, client: ContentClient, ingestDir: URL, progress: ProgressHandler? = nil) {
3535
self.client = client
3636
self.ingestDir = ingestDir
3737
self.contentStore = contentStore
@@ -40,7 +40,7 @@ extension ImageStore {
4040
}
4141

4242
/// Pull the required image layers for the provided descriptor and platform(s) into the given directory using the provided client. Returns a descriptor to the Index manifest.
43-
internal func `import`(root: Descriptor, matcher: (ContainerizationOCI.Platform) -> Bool) async throws -> Descriptor {
43+
public func `import`(root: Descriptor, matcher: (ContainerizationOCI.Platform) -> Bool) async throws -> Descriptor {
4444
var toProcess = [root]
4545
while !toProcess.isEmpty {
4646
// Count the total number of blobs and their size
@@ -123,14 +123,14 @@ extension ImageStore {
123123
for _ in 0..<8 {
124124
if let desc = iterator.next() {
125125
group.addTask {
126-
try await fetch(desc)
126+
try await self.fetch(desc)
127127
}
128128
}
129129
}
130130
for try await _ in group {
131131
if let desc = iterator.next() {
132132
group.addTask {
133-
try await fetch(desc)
133+
try await self.fetch(desc)
134134
}
135135
}
136136
}

Sources/Containerization/NATNetworkInterface.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public final class NATNetworkInterface: Interface, Sendable {
3131
public let macAddress: String?
3232

3333
@available(macOS 26, *)
34+
// `reference` isn't used concurrently.
3435
public nonisolated(unsafe) let reference: vmnet_network_ref!
3536

3637
@available(macOS 26, *)

Sources/Containerization/UnixSocketRelay.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ extension SocketRelay {
267267
)
268268
}
269269

270+
// `buf1` isn't used concurrently.
270271
nonisolated(unsafe) let buf1 = UnsafeMutableBufferPointer<UInt8>.allocate(capacity: Int(getpagesize()))
271272
connSource.setEventHandler {
272273
Self.fdCopyHandler(
@@ -278,6 +279,7 @@ extension SocketRelay {
278279
}
279280

280281
nonisolated(unsafe) let buf2 = UnsafeMutableBufferPointer<UInt8>.allocate(capacity: Int(getpagesize()))
282+
// `buf2` isn't used concurrently.
281283
vsockConnectionSource.setEventHandler {
282284
Self.fdCopyHandler(
283285
buffer: buf2,

Sources/Containerization/VZVirtualMachineInstance.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct VZVirtualMachineInstance: VirtualMachineInstance, Sendable {
6868
}
6969
}
7070

71+
// `vm` isn't used concurrently.
7172
private nonisolated(unsafe) let vm: VZVirtualMachine
7273
private let queue: DispatchQueue
7374
private let group: MultiThreadedEventLoopGroup

Sources/ContainerizationOS/AsyncSignalHandler.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public final class AsyncSignalHandler: Sendable {
5353

5454
struct State: Sendable {
5555
var conts: [AsyncStream<Int32>.Continuation] = []
56+
// `sources` isn't used concurrently.
5657
nonisolated(unsafe) var sources: [any DispatchSourceSignal] = []
5758
}
5859

Sources/Integration/ProcessTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ extension IntegrationSuite {
6262
}
6363

6464
final class BufferWriter: Writer {
65+
// `data` isn't used concurrently.
6566
nonisolated(unsafe) var data = Data()
6667

6768
func write(_ data: Data) throws {

0 commit comments

Comments
 (0)