Documentation ¶
Index ¶
Constants ¶
const ( // FirstGen is a number of the first generation for an object FirstGen Generation = 1 // LastGen is a number of the initial generation for an object LastGen Generation = 0 // SystemNS is a name of system namespace SystemNS = "system" // EmptyName is the default empty name for runtime objects EmptyName = "" )
const KeySeparator = "/"
KeySeparator is used to separate key parts (namespace, kind, name)
const MaxGeneration = Generation(math.MaxUint64)
MaxGeneration is a constant which defines max value for a generation
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
Codec interface represents combination of Encoder and Decoder interfaces for both sides encoding/decoding of runtime objects to/from bytes
type Constructor ¶
type Constructor func() Object
Constructor is a function to get instance of the specific object
type Decoder ¶
type Decoder interface { DecodeOne(data []byte) (Object, error) DecodeOneOrMany(data []byte) ([]Object, error) }
Decoder interface represents decoding of the runtime objects from bytes
type Deletable ¶ added in v0.1.10
Deletable extends Versioned with deleted marker to represent versioned objects that could be marked as deleted, but then created again even with the same content. Best example of such objects is policy objects (and the only for now).
type Displayable ¶ added in v0.1.2
Displayable represents object that could be represented as columns and have some default set of columns to be shown
type Encoder ¶
type Encoder interface { EncodeOne(obj Object) ([]byte, error) EncodeMany(objs []Object) ([]byte, error) }
Encoder interface represents encoding of the runtime objects into bytes
type Generation ¶
type Generation uint64
Generation represents object's "version" and starts from 0
func ParseGeneration ¶
func ParseGeneration(gen string) Generation
ParseGeneration returns Generation type representation of specified generation string
func (Generation) Next ¶
func (gen Generation) Next() Generation
Next returns the next generation of the base object (current + 1)
func (Generation) String ¶
func (gen Generation) String() string
String returns generation as string to implement Stringer interface
type GenerationMetadata ¶
type GenerationMetadata struct {
Generation Generation
}
GenerationMetadata is the default struct for metadata with only generation in it
type Info ¶
type Info struct { Kind Kind Storable bool Versioned bool Deletable bool Constructor Constructor }
Info represents list of additional characteristics of the runtime object
func (*Info) GetTypeKind ¶
GetTypeKind returns TypeKind instance for the object described by info
type Key ¶
type Key = string
Key represents storable object key - namespace + kind + name separated by KeySeparator
func KeyForStorable ¶
KeyForStorable returns Key for storable object
type Object ¶
type Object interface {
GetKind() Kind
}
Object represents minimal object that could be operated in runtime with only Kind being mandatory characteristic
type Registry ¶
Registry contains a map of objects info structures by their kind
type Storable ¶
Storable represents runtime object that could be stored in database and having two additional mandatory characteristics: Name and Namespace that together with Kind forms Key (namespace + kind + name) that represents coordinates of the object in database
type TypeKind ¶
type TypeKind struct {
Kind Kind
}
TypeKind represents type definition of the runtime object, should be embedded into all runtime objects with `yaml:",inline"` for proper yaml codec encoding and decoding
type Versioned ¶
type Versioned interface { Storable GetGeneration() Generation SetGeneration(gen Generation) }
Versioned extends Storable with mandatory Generation characteristic to represent versioned objects that are having multiple generations stored in database