Commit Graph

24 Commits (9c72e6e9231d0f279a70d46c74607f45d5af2db5)

Author SHA1 Message Date
Clayton Coleman b8582f73da Ensure public conversion name packages are imported
The name of the package a public function is in may not be inside the
current package set, so it needs to be imported.
2016-02-08 17:24:44 -05:00
Clayton Coleman 60b66665e1 Move conversion.Scheme to runtime
There is only one type registry to rule them all
2016-01-30 14:12:40 -05:00
Clayton Coleman 63a7a41ddf Simplify Codec and split responsibilities
Break Codec into two general purpose interfaces, Encoder and Decoder,
and move parameter codec responsibilities to ParameterCodec.

Make unversioned types explicit when registering - these types go
through conversion without modification.

Switch to use "__internal" instead of "" to represent the internal
version. Future commits will also add group defaulting (so that "" is
expanded internally into a known group version, and only cleared during
set).

For embedded types like runtime.Object -> runtime.RawExtension, put the
responsibility on the caller of Decode/Encode to handle transformation
into destination serialization. Future commits will expand RawExtension
and Unknown to accept a content encoding as well as bytes.

Make Unknown a bit more powerful and use it to carry unrecognized types.
2016-01-21 23:18:32 -05:00
Clayton Coleman 3c1451af91 Use public conversion methods to avoid reflection
Replace many of the remaining s.Convert() invocations with direct
execution, and make generated methods public. Removes 10% of the
allocations during decode of a pod and ~20-40% of the total CPU time.
2015-12-29 10:38:42 -05:00
Clayton Coleman 173718059d Slice conversion requires destination package 2015-12-18 19:05:21 -05:00
deads2k 519b4e80d1 update NewObject for groupversionkind 2015-12-09 08:13:15 -05:00
Clayton Coleman 8046bb46df Update conversions to handle primitive conversion 2015-11-26 11:45:25 -05:00
deads2k ed95a6d77f update scheme to use GroupVersion 2015-11-25 12:15:48 -05:00
deads2k 47e496364d update generators for groupVersion 2015-11-25 12:14:06 -05:00
deads2k 68b0572974 internal versions 2015-11-25 12:14:06 -05:00
Tim Hockin fd91d3f0ec Make patch-up conversions simpler
Rather than an "all or nothing" approach to defining a custom conversion
function (which seems destined to cause problems eventually), this is an
attempt to make it possible to call the auto-generated code and then "fix it
up".

Specifically, consider you have a fooBar struct.  If you don't define a
conversion for FooBar, you will get a generated function like:
    convert_v1_FooBar_To_api_FooBar()

Before this PR, if you define your own conversion function, you get no
generated function.  After this PR you get:
    autoconvert_v1_FooBar_To_api_FooBar()
...which you can call yourself in your custom function.
2015-09-24 17:21:07 -07:00
tummychow 78ce5da988 Move util.StringSet into its own package
A lot of packages use StringSet, but they don't use anything else from
the util package. Moving StringSet into another package will shrink
their dependency trees significantly.
2015-09-10 12:04:15 -07:00
Kris Rousey 565189f5b8 Correcting all go vet errors 2015-08-11 13:55:37 -07:00
Paul Weil 26d80cdb7f use package from out value 2015-08-10 14:00:20 -04:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
Clayton Coleman 0f9fdcafea Revert "Revert "Improve conversion to support multiple packages""
This reverts commit 94a387d5d1.
2015-07-30 15:15:14 -04:00
Mike Danese 94a387d5d1 Revert "Improve conversion to support multiple packages" 2015-07-30 10:51:40 -07:00
Clayton Coleman 732647ea97 Improve conversion to support multiple packages
OpenShift uses multiple API packages (types are split) which
Kube will also eventually have as we introduce more plugins.
These changes make the generators able to handle importing different
API object packages into a single generator function.
2015-07-29 17:05:54 -04:00
Wojciech Tyczynski de0a1d179f Fix ordering of conversion methods. 2015-05-21 19:41:48 +02:00
Tim Hockin 70c94fad6d Don't rename api imports in conversions 2015-05-19 11:21:21 -07:00
Wojciech Tyczynski 9a93206774 Script for automatically generate conversions. 2015-05-19 02:17:58 +02:00
Wojciech Tyczynski 108615d081 Refactor conversion generator 2015-05-15 15:11:18 +02:00
Wojciech Tyczynski b52a4e60fc Fix convertion generator for manually written ones 2015-05-14 13:51:34 +02:00
Wojciech Tyczynski 5578dc99e3 Improvements for conversions generator 2015-05-11 12:21:11 +02:00