package json
import "k8s.io/kubernetes/pkg/watch/json"
Package json implements a simple encoder and decoder for streams of watch events over io.Writer/Readers
Index ¶
- func Object(codec runtime.Codec, event *watch.Event) (interface{}, error)
- type Decoder
- func NewDecoder(r io.ReadCloser, codec runtime.Codec) *Decoder
- func (d *Decoder) Close()
- func (d *Decoder) Decode() (watch.EventType, runtime.Object, error)
- type Encoder
Functions ¶
func Object ¶
Object converts a watch.Event into an appropriately serializable JSON object
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder implements the watch.Decoder interface for io.ReadClosers that have contents which consist of a series of watchEvent objects encoded via JSON. It will decode any object registered in the supplied codec.
func NewDecoder ¶
func NewDecoder(r io.ReadCloser, codec runtime.Codec) *Decoder
NewDecoder creates an Decoder for the given writer and codec.
func (*Decoder) Close ¶
func (d *Decoder) Close()
Close closes the underlying r.
func (*Decoder) Decode ¶
Decode blocks until it can return the next object in the writer. Returns an error if the writer is closed or an object can't be decoded.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder implements the json.Encoder interface for io.Writers that should serialize watchEvent objects into JSON. It will encode any object registered in the supplied codec and return an error otherwies.
func NewEncoder ¶
NewEncoder creates an Encoder for the given writer and codec
func (*Encoder) Encode ¶
Encode writes an event to the writer. Returns an error if the writer is closed or an object can't be encoded.
Source Files ¶
decoder.go doc.go encoder.go types.go
- Version
- v0.5.3
- Published
- Nov 24, 2014
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 45 seconds ago –
Tools for package owners.