mirror of
https://github.com/apple/container.git
synced 2026-09-13 03:05:42 +00:00
Continue documenting public surface (#25)
Signed-off-by: Danny Canter <danny_canter@apple.com>
This commit is contained in:
@@ -32,6 +32,7 @@ public protocol AddressAllocator<AddressType>: Sendable {
|
||||
func disableAllocator() -> Bool
|
||||
}
|
||||
|
||||
/// Errors that a type implementing AddressAllocator should throw.
|
||||
public enum AllocatorError: Swift.Error, CustomStringConvertible, Equatable {
|
||||
case allocatorDisabled
|
||||
case allocatorFull
|
||||
|
||||
@@ -31,6 +31,7 @@ public actor AsyncLock {
|
||||
|
||||
public init() {}
|
||||
|
||||
/// withLock provides a scoped locking API to run a function while holding the lock.
|
||||
public func withLock<T: Sendable>(_ body: @Sendable @escaping (Context) async throws -> T) async rethrows -> T {
|
||||
while self.busy {
|
||||
await withCheckedContinuation { cc in
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
import Foundation
|
||||
|
||||
extension FileManager {
|
||||
/// Returns a unique temporary directory to use.
|
||||
public func uniqueTemporaryDirectory(create: Bool = true) -> URL {
|
||||
let tempDirectoryURL = temporaryDirectory
|
||||
let uniqueDirectoryURL = tempDirectoryURL.appendingPathComponent(UUID().uuidString)
|
||||
|
||||
@@ -96,6 +96,7 @@ extension UInt32 {
|
||||
extension Character {
|
||||
private static let deviceLetters = Array("abcdefghijklmnopqrstuvwxyz")
|
||||
|
||||
/// Creates an allocator for block device tags, or any character values.
|
||||
public static func blockDeviceTagAllocator() -> any AddressAllocator<Character> {
|
||||
IndexedAddressAllocator(
|
||||
size: Self.deviceLetters.count,
|
||||
|
||||
Reference in New Issue
Block a user