Documentation ¶
Index ¶
- Constants
- func ParseConfig(configPath string) ([]common.ResourcesConfig, error)
- func ValidateConfig(configs []common.ResourcesConfig, resources []common.Resource) error
- type Client
- type ConfigConverter
- type Mason
- type Masonable
- type Storage
- func (s *Storage) AddConfig(conf common.ResourcesConfig) error
- func (s *Storage) DeleteConfig(name string) error
- func (s *Storage) GetConfig(name string) (common.ResourcesConfig, error)
- func (s *Storage) GetConfigs() ([]common.ResourcesConfig, error)
- func (s *Storage) SyncConfigs(newConfigs []common.ResourcesConfig) error
- func (s *Storage) UpdateConfig(conf common.ResourcesConfig) error
Constants ¶
const (
// LeasedResources is a common.UserData entry
LeasedResources = "leasedResources"
)
Variables ¶
This section is empty.
Functions ¶
func ParseConfig ¶
func ParseConfig(configPath string) ([]common.ResourcesConfig, error)
ParseConfig reads data stored in given config path In: configPath - path to the config file Out: A list of ResourceConfig object on success, or nil on error.
func ValidateConfig ¶
func ValidateConfig(configs []common.ResourcesConfig, resources []common.Resource) error
ValidateConfig validates config with existing resources In: configs - a list of resources configs
resources - a list of resources
Out: nil on success, error on failure
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client extends boskos client with support with resource with leased resources
func NewClient ¶
func NewClient(boskosClient boskosClient) *Client
NewClient creates a new client from a boskosClient interface
func (*Client) ReleaseOne ¶
ReleaseOne will release a resource as well as leased resources associated to it
type ConfigConverter ¶
ConfigConverter converts a string into a Masonable
type Mason ¶
type Mason struct {
// contains filtered or unexported fields
}
Mason uses config to convert dirty resources to usable one
func NewMason ¶
NewMason creates and initialized a new Mason object In: rtypes - A list of resource types to act on
cleanerCount - Number of cleaning threads client - boskos client waitPeriod - time to wait before a new boskos operation (acquire mostly) syncPeriod - time to wait before syncing resource information to boskos
Out: A Pointer to a Mason Object
func (*Mason) RegisterConfigConverter ¶
func (m *Mason) RegisterConfigConverter(name string, fn ConfigConverter) error
RegisterConfigConverter is used to register a new Masonable interface In: name - identifier for Masonable implementation
fn - function that will parse the configuration string and return a Masonable interface
Out: nil on success, error otherwise
func (*Mason) UpdateConfigs ¶
UpdateConfigs updates configs from storage path In: storagePath - the path to read the config file from Out: nil on success error otherwise
type Masonable ¶
type Masonable interface {
Construct(context.Context, common.Resource, common.TypeToResources) (*common.UserData, error)
}
Masonable should be implemented by all configurations
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage stores configuration information
func (*Storage) AddConfig ¶
func (s *Storage) AddConfig(conf common.ResourcesConfig) error
AddConfig adds a new config
func (*Storage) DeleteConfig ¶
DeleteConfig deletes an existing config if it exists or fail otherwise
func (*Storage) GetConfig ¶
func (s *Storage) GetConfig(name string) (common.ResourcesConfig, error)
GetConfig returns an existing if it exists errors out otherwise
func (*Storage) GetConfigs ¶
func (s *Storage) GetConfigs() ([]common.ResourcesConfig, error)
GetConfigs returns all configs
func (*Storage) SyncConfigs ¶
func (s *Storage) SyncConfigs(newConfigs []common.ResourcesConfig) error
SyncConfigs syncs new configs
func (*Storage) UpdateConfig ¶
func (s *Storage) UpdateConfig(conf common.ResourcesConfig) error
UpdateConfig updates a given if it exists or fail otherwise