Commit Graph

9 Commits

Author SHA1 Message Date
unclejack e59aad9cd3 pkg/units: fix size_test.go compilation
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-19 18:38:12 +02:00
Srini Brahmaroutu c16e41245e Fix to avoid a compile error due to float to int truncation with GCCGO
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-12-17 22:44:55 +00:00
Victor Vieux ae4689f14d add BytesSize in pkg/units
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-10-14 03:54:32 +00:00
Francisco Carriedo 81c7d28b84 pkg/units: Updated tests with unit constants
Also, now that I was at it, gave them a small refactor.

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-26 20:00:18 -07:00
Francisco Carriedo 0fd37bd7ac pkg/units: Standardized supported sizes
May make sense that both `FromHumanSize()` and `RAMInBytes()` support
the same units. Added 'PB' to the RAMInBytes regex.

Also updated tests.

Note: int64 is overflowed on quantities >= EB

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-23 23:37:06 -07:00
Francisco Carriedo c47ab1425f pkg/units: Increased test coverage. Closes #7159.
Increased coverage:

  * Added test cases to size_test.go
  * Added coverage for duration.go

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-22 09:56:58 -07:00
Mike Snitzer 2470a5ed99 devmapper: use RAMInBytes() rather than FromHumanSize()
Device Mapper needs device sizes in binary (1024) multiples.  Otherwise
kernel checks can find that the specified thin-pool device sizes aren't
a multiple of the specified thin-pool blocksize.

The name for "RAMInBytes" is likely too narrow given the new consumers
but... Also add "tebibyte" support to RAMInBytes.

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
2014-06-24 12:10:14 -04:00
Alexander Larsson 13f07b636f pkg/units: Add FromHumanSize
This does the "reverse" of HumanSize, i.e. maps a string to an int64
using SI prefixes for the extension.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-06-05 10:02:37 +02:00
Michael Crosby d33b4655c4 Move duration and size to units pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-05-12 17:05:07 -07:00