top

Package codable provides types that implement encoding.BinaryMarshaler and encoding.BinaryUnmarshaler and functions that help to encode and decode primitives. The Prometheus storage backend uses them to persist objects to files and to save objects in LevelDB.

The encodings used in this package are designed in a way that objects can be unmarshaled from a continuous byte stream, i.e. the information when to stop reading is determined by the format. No separate termination information is needed.

Strings are encoded as the length of their bytes as a varint followed by their bytes.

Slices are encoded as their length as a varint followed by their elements.

Maps are encoded as the number of mappings as a varint, followed by the mappings, each of which consists of the key followed by the value.

Imports 1 package(s) ΒΆ

  1. github.com/prometheus/common/model