14 lines
387 B
Swift
14 lines
387 B
Swift
import Foundation
|
|
|
|
@MainActor
|
|
final class MCPTransferBudget {
|
|
nonisolated static let maximumBytes = 10 * 1_024 * 1_024 * 1_024
|
|
private var active: Set<UUID> = []
|
|
func claim(_ id: UUID) -> Bool {
|
|
guard active.count < 4, !active.contains(id) else { return false }
|
|
active.insert(id)
|
|
return true
|
|
}
|
|
func release(_ id: UUID) { active.remove(id) }
|
|
}
|