Commit graph

34 commits

Author SHA1 Message Date
Hu Keping
250ce20fee Remove useless conversion
It is already type float.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-06-24 00:47:08 +08:00
Zhang Wei
d91ae65280 clean some redundant else clauses
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-05-19 10:54:04 +08:00
Doug Davis
e8bbd87ba8 Merge pull request #12888 from jmzwcn/patch-3
`docker images` friendly duration gets unfriendly after a while
2015-05-03 11:09:25 -04:00
Daniel Zhang
28ea4a63d0 docker images friendly duration gets unfriendly after a while
fix #12852
Signed-off-by: Daniel Zhang <jmzwcn@gmail.com>
2015-05-03 21:19:18 +08:00
Ma Shimiao
8a2f899286 use CustomSize replace intToString
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-29 08:30:25 +08:00
Arnaud Porterie
89bdaa35e0 Remove subdirectories MAINTAINERS files
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-06 18:21:51 -08:00
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
Michael Crosby
2acb856dff Merge pull request #9233 from inatatsu/fix-pkg-units-size-for-gccgo
Fix to avoid a compile error due to float to int truncation with GCCGO
2014-12-18 18:33:01 -08: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
Tatsushi Inagaki
82a5cd0d37 Fix to avoid a compilation error of size_test.go with GCCGO due to float to int truncation
Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
2014-11-25 18:12:22 +09:00
Tatsushi Inagaki
36560a76d7 Revert "Fix to avoid a compile error due to float to int truncation with GCCGO"
This reverts commit 967a42f116.

Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>

Roll back the change to fix the parameter of HumanSize from int64 to float64
2014-11-25 16:48:09 +09:00
Tatsushi Inagaki
967a42f116 Fix to avoid a compile error due to float to int truncation with GCCGO
Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
2014-11-19 15:06:49 +09:00
Solomon Hykes
f0327c99dd Merge pull request #8198 from jfrazelle/add-jessie-to-various-maintainers
Adding self to various maintainers files.
2014-10-28 19:35:28 -07:00
Tibor Vass
9df3e45ba9 Merge pull request #8423 from unclejack/lint_changes
lint changes part 1
2014-10-21 12:15:58 -04: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
unclejack
d202ff2ece pkg/units: lint
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-06 22:19:41 +03:00
Jessica Frazelle
6c60e8c784 Adding self to various maintainers files.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-09-29 15:43:07 -07:00
Phil Estes
4119c9d7d9 Refactor all pre-compiled regexp to package level vars
Addresses #8057

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2014-09-16 12:57:44 -04: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
c7a2e86b51 pkg/units: Unit constants directly int64
int64 seems sufficient

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-26 20:00:08 -07:00
fcarriedo
2fb63aba0b pkg/units: including suggestions and enhancements
Docker-DCO-1.1-Signed-off-by: fcarriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-25 09:33:04 -07:00
fcarriedo
c765134ac9 pkg/units: Updated Compile() to MustCompile()
We were doing exactly what `regexp.MustCompile()` already does.

Docker-DCO-1.1-Signed-off-by: fcarriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-24 13:19:20 -07:00
Francisco Carriedo
386d300a6e pkg/units: Refactored common code to single func
Both functions perform the same logic and they just vary on the base
multiplication units. We can refactor the common code into a single
place.

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-24 00:03:59 -07:00
Francisco Carriedo
e4ab996b9d pkg/units: Moved 'units' out of function
No need to initialize every time the function executes since it works as
a catalog.

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-24 00:03:59 -07:00
Francisco Carriedo
d512294382 pkg/units: Compacted var declaration and initialization
No need to have two lines. The type is even explicit when type casting
to `float64(size)`

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-24 00:03:40 -07:00
Francisco Carriedo
a4d57d8a85 pkg/units: Refactor regexp.Compile to init()
No need to recompile a fixed regular expression each time the function
executes. Abstracting it to the `init()` method.

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-23 23:45:03 -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
03697f0a93 pkg/units: Using 'case' instead of trickled ifs
Seems the perfect case for 'case' ;).

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-23 20:38:36 -07:00
Francisco Carriedo
ea7b8ea03f pkg/units: Better to not use error as var name
Better to not use `error` as var name (might eclipse the error type) for
clarity and to prevent subtle bugs.

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-22 15:39:59 -07:00
Francisco Carriedo
588090c49b pkg/units: Remove unused named returns
Remove named returns since not used in function body.  Might prevent
potential subtle bugs.

Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
2014-07-22 12:16:50 -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