Documentation ¶
Index ¶
- Constants
- type BoskosConfig
- type CommaSeparatedStrings
- type ConfigType
- type Item
- type LeasedResources
- type MasonConfig
- type Metric
- type Resource
- type ResourceByName
- type ResourceByUpdateTime
- type ResourceEntry
- type ResourceNeeds
- type ResourcesConfig
- type ResourcesConfigByName
- type TypeToResources
- type UserData
- func (ud *UserData) Extract(id string, out interface{}) error
- func (ud *UserData) FromMap(m UserDataMap)
- func (ud *UserData) MarshalJSON() ([]byte, error)
- func (ud *UserData) Set(id string, in interface{}) error
- func (ud *UserData) ToMap() UserDataMap
- func (ud *UserData) UnmarshalJSON(data []byte) error
- func (ud *UserData) Update(new *UserData)
- type UserDataMap
- type UserDataNotFound
Constants ¶
const ( // Busy state defines a resource being used. Busy = "busy" // Dirty state defines a resource that needs cleaning Dirty = "dirty" // Free state defines a resource that is usable Free = "free" // Cleaning state defines a resource being cleaned Cleaning = "cleaning" // Leased state defines a resource being leased in order to make a new resource Leased = "leased" // Other is used to agglomerate unspecified states for metrics reporting Other = "other" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoskosConfig ¶
type BoskosConfig struct {
Resources []ResourceEntry `json:"resources,flow"`
}
BoskosConfig defines config used by boskos server
type CommaSeparatedStrings ¶
type CommaSeparatedStrings []string
CommaSeparatedStrings is used to parse comma separated string flag into a list of strings
func (*CommaSeparatedStrings) Set ¶
func (r *CommaSeparatedStrings) Set(value string) error
Set parses the flag value into a CommaSeparatedStrings
func (*CommaSeparatedStrings) String ¶
func (r *CommaSeparatedStrings) String() string
type ConfigType ¶
type ConfigType struct { // Identifier of the struct this maps back to Type string `json:"type,omitempty"` // Marshaled JSON content Content string `json:"content,omitempty"` }
ConfigType gather the type of config to be applied by Mason in order to construct the resource
type LeasedResources ¶
type LeasedResources []string
LeasedResources is a list of resources name that used in order to create another resource by Mason
type MasonConfig ¶
type MasonConfig struct {
Configs []ResourcesConfig `json:"configs,flow,omitempty"`
}
MasonConfig holds Mason config information
type Metric ¶
type Metric struct { Type string `json:"type"` Current map[string]int `json:"current"` Owners map[string]int `json:"owner"` }
Metric contains analytics about a specific resource type
type Resource ¶
type Resource struct { Type string `json:"type"` Name string `json:"name"` State string `json:"state"` Owner string `json:"owner"` LastUpdate time.Time `json:"lastupdate"` // Customized UserData UserData *UserData `json:"userdata"` }
Resource abstracts any resource type that can be tracked by boskos
func ItemToResource ¶
ItemToResource casts a Item back to a Resource
func NewResource ¶
NewResource creates a new Boskos Resource.
func NewResourcesFromConfig ¶
func NewResourcesFromConfig(e ResourceEntry) []Resource
NewResourcesFromConfig parse the a ResourceEntry into a list of resources
type ResourceByName ¶
type ResourceByName []Resource
ResourceByName helps sorting resources by name
func (ResourceByName) Len ¶
func (ut ResourceByName) Len() int
func (ResourceByName) Less ¶
func (ut ResourceByName) Less(i, j int) bool
func (ResourceByName) Swap ¶
func (ut ResourceByName) Swap(i, j int)
type ResourceByUpdateTime ¶
type ResourceByUpdateTime []Resource
ResourceByUpdateTime helps sorting resources by update time
func (ResourceByUpdateTime) Len ¶
func (ut ResourceByUpdateTime) Len() int
func (ResourceByUpdateTime) Less ¶
func (ut ResourceByUpdateTime) Less(i, j int) bool
func (ResourceByUpdateTime) Swap ¶
func (ut ResourceByUpdateTime) Swap(i, j int)
type ResourceEntry ¶
type ResourceEntry struct { Type string `json:"type"` State string `json:"state"` Names []string `json:"names,flow"` }
ResourceEntry is resource config format defined from config.yaml
type ResourceNeeds ¶
ResourceNeeds maps the type to count of resources types needed
type ResourcesConfig ¶
type ResourcesConfig struct { Name string `json:"name"` Config ConfigType `json:"config"` Needs ResourceNeeds `json:"needs"` }
ResourcesConfig holds information to construct a resource. The ResourcesConfig Name maps to the Resource Type All Resource of a given type will be constructed using the same configuration
func ItemToResourcesConfig ¶
func ItemToResourcesConfig(i Item) (ResourcesConfig, error)
ItemToResourcesConfig casts an Item object to a ResourcesConfig
func (ResourcesConfig) GetName ¶
func (conf ResourcesConfig) GetName() string
GetName implements the item interface for storage
type ResourcesConfigByName ¶
type ResourcesConfigByName []ResourcesConfig
ResourcesConfigByName helps sorting ResourcesConfig by name
func (ResourcesConfigByName) Len ¶
func (ut ResourcesConfigByName) Len() int
func (ResourcesConfigByName) Less ¶
func (ut ResourcesConfigByName) Less(i, j int) bool
func (ResourcesConfigByName) Swap ¶
func (ut ResourcesConfigByName) Swap(i, j int)
type TypeToResources ¶
TypeToResources stores all the leased resources with the same type f
func (TypeToResources) Copy ¶
func (t TypeToResources) Copy() TypeToResources
Copy returns a copy of the TypeToResources
type UserData ¶
UserData is a map of Name to user defined interface, serialized into a string
func UserDataFromMap ¶
func UserDataFromMap(m UserDataMap) *UserData
UserDataFromMap returns a UserData from a map
func (*UserData) FromMap ¶
func (ud *UserData) FromMap(m UserDataMap)
FromMap feels updates user data from a map
func (*UserData) MarshalJSON ¶
MarshalJSON implements JSON Marshaler interface
func (*UserData) ToMap ¶
func (ud *UserData) ToMap() UserDataMap
ToMap converts a UserData to UserDataMap
func (*UserData) UnmarshalJSON ¶
UnmarshalJSON implements JSON Unmarshaler interface
type UserDataMap ¶
UserDataMap is the standard Map version of UserMap, it is used to ease UserMap creation.
type UserDataNotFound ¶
type UserDataNotFound struct {
ID string
}
UserDataNotFound will be returned if requested resource does not exist.
func (*UserDataNotFound) Error ¶
func (ud *UserDataNotFound) Error() string