Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyToDefaultDeletePath ¶
KeyToDefaultDeletePath converts one of the Keys from this package into a unique '/'-delimited path, which is suitable for use as the key when (recursively) deleting the value from a hierarchical (i.e. one with directories and leaves) key/value datastore such as etcd v3.
KeyToDefaultDeletePath returns a different path to KeyToDefaultPath when it is a passed a Key that represents a non-leaf which, for example, has its own metadata but also contains other resource types as children.
KeyToDefaultDeletePath returns the common prefix of the non-leaf key and its children so that a recursive delete of that key would delete the object itself and any children it has.
func KeyToDefaultPath ¶
KeyToDefaultPath converts one of the Keys from this package into a unique '/'-delimited path, which is suitable for use as the key when storing the value in a hierarchical (i.e. one with directories and leaves) key/value datastore such as etcd v3.
Each unique key returns a unique path.
Keys with a hierarchical relationship share a common prefix. However, in order to support datastores that do not support storing data at non-leaf nodes in the hierarchy (such as etcd v3), the path returned for a "parent" key, is not a direct ancestor of its children.
func ParseValue ¶
ParseValue parses the default JSON representation of our data into one of our value structs, according to the type of key. I.e. if passed a PolicyKey as the first parameter, it will try to parse rawData into a Policy struct.
func SerializeValue ¶
Serialize a value in the model to a []byte to stored in the datastore. This performs the opposite processing to ParseValue()
Types ¶
type KVPair ¶
type KVPair struct { Key Key Value interface{} Revision string UID *types.UID TTL time.Duration // For writes, if non-zero, key has a TTL. }
KVPair holds a typed key and value object as well as datastore specific revision information.
The Value is dependent on the Key, but in general will be on of the following types:
- A pointer to a struct
- A slice or map
- A bare string, boolean value or IP address (i.e. without quotes, so not JSON format).
type Key ¶
type Key interface { // String returns a unique string representation of this key. The string // returned by this method must uniquely identify this Key. String() string // contains filtered or unexported methods }
type Node ¶
type Node struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` InternalIP string `json:"internalip,omitempty"` Hostname string `json:"hostname,omitempty"` PodCIDR string `json:"podCIDR,omitempty"` Labels map[string]string `json:"labels,omitempty"` UID types.UID `json:"uid,omitempty"` }