MCPcopy
hub / github.com/kubernetes/client-go / Encode

Method Encode

rest/watch/encoder.go:46–56  ·  view source on GitHub ↗

Encode writes an event to the writer. Returns an error if the writer is closed or an object can't be encoded.

(event *watch.Event)

Source from the content-addressed store, hash-verified

44// Encode writes an event to the writer. Returns an error
45// if the writer is closed or an object can't be encoded.
46func (e *Encoder) Encode(event *watch.Event) error {
47 data, err := runtime.Encode(e.embeddedEncoder, event.Object)
48 if err != nil {
49 return err
50 }
51 // FIXME: get rid of json.RawMessage.
52 return e.encoder.Encode(&metav1.WatchEvent{
53 Type: string(event.Type),
54 Object: runtime.RawExtension{Raw: json.RawMessage(data)},
55 })
56}

Callers 6

handleResizesMethod · 0.95
TestWatchFunction · 0.95
TestWatchFunction · 0.95
TestDecoderFunction · 0.95
TestWatchFunction · 0.95

Calls

no outgoing calls

Tested by 5

TestWatchFunction · 0.76
TestWatchFunction · 0.76
TestDecoderFunction · 0.76
TestWatchFunction · 0.76