File tree Expand file tree Collapse file tree
ContainerCommands/System/Property
Services/ContainerAPIService/Client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ extension Application {
7575 }
7676 DefaultsStore . set ( value: value, key: key)
7777 case . defaultContainerMemory:
78- guard let memoryMiB = try ? Parser . memoryString ( value) , memoryMiB > 0 else {
78+ guard let memoryMiB = try ? Parser . memoryStringAsMiB ( value) , memoryMiB > 0 else {
7979 throw ContainerizationError ( . invalidArgument, message: " invalid memory value: \( value) " )
8080 }
8181 DefaultsStore . set ( value: value, key: key)
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public enum VolumeOrFilesystem {
4545}
4646
4747public struct Parser {
48- public static func memoryString ( _ memory: String ) throws -> Int64 {
48+ public static func memoryStringAsMiB ( _ memory: String ) throws -> Int64 {
4949 let ram = try Measurement . parse ( parsing: memory)
5050 let mb = ram. converted ( to: . mebibytes)
5151 return Int64 ( mb. value)
@@ -97,9 +97,9 @@ public struct Parser {
9797 resource. cpus = cpuVal
9898 }
9999 if let memory {
100- resource. memoryInBytes = try Parser . memoryString ( memory) . mib ( )
100+ resource. memoryInBytes = try Parser . memoryStringAsMiB ( memory) . mib ( )
101101 } else if let memStr = DefaultsStore . getOptional ( key: . defaultContainerMemory) {
102- resource. memoryInBytes = try Parser . memoryString ( memStr) . mib ( )
102+ resource. memoryInBytes = try Parser . memoryStringAsMiB ( memStr) . mib ( )
103103 }
104104 return resource
105105 }
@@ -403,7 +403,7 @@ public struct Parser {
403403 throw ContainerizationError ( . invalidArgument, message: " unsupported option size for \( type) mount " )
404404 }
405405 var overflow : Bool
406- var memory = try Parser . memoryString ( val)
406+ var memory = try Parser . memoryStringAsMiB ( val)
407407 ( memory, overflow) = memory. multipliedReportingOverflow ( by: 1024 * 1024 )
408408 if overflow {
409409 throw ContainerizationError ( . invalidArgument, message: " overflow encountered when parsing memory string: \( val) " )
You can’t perform that action at this time.
0 commit comments