Implement support for CacheableObject
Kubernetes-commit: 970f103e2c079da98743db35e38fd411a64e2e04
This commit is contained in:
parent
f186d58ea0
commit
94a2664cd3
|
|
@ -64,6 +64,13 @@ func identifier(e runtime.Encoder) runtime.Identifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c stripVersionEncoder) Encode(obj runtime.Object, w io.Writer) error {
|
func (c stripVersionEncoder) Encode(obj runtime.Object, w io.Writer) error {
|
||||||
|
if co, ok := obj.(runtime.CacheableObject); ok {
|
||||||
|
return co.CacheEncode(c.Identifier(), c.doEncode, w)
|
||||||
|
}
|
||||||
|
return c.doEncode(obj, w)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c stripVersionEncoder) doEncode(obj runtime.Object, w io.Writer) error {
|
||||||
buf := bytes.NewBuffer([]byte{})
|
buf := bytes.NewBuffer([]byte{})
|
||||||
err := c.encoder.Encode(obj, buf)
|
err := c.encoder.Encode(obj, buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue