Documentation ¶
Overview ¶
Package resource defines the interface that each resource manager needs to implement to get compute units
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplID = errors.New("duplicate ID found in clusters config") ErrUnknownManager = errors.New("unknown resource manager found in the config") ErrInvalidID = errors.New("invalid cluster ID. It must contain only [a-zA-Z0-9-_]") )
Custom errors.
Functions ¶
Types ¶
type Config ¶
type Config[T any] struct { Clusters []T `yaml:"clusters"` }
Config contains the configuration of resource manager cluster(s).
type Fetcher ¶
type Fetcher interface { // FetchUnits fetches compute units between start and end times FetchUnits(ctx context.Context, start time.Time, end time.Time) ([]models.ClusterUnits, error) // FetchUsersProjects fetches latest projects, users and their associations FetchUsersProjects(ctx context.Context, currentTime time.Time) ([]models.ClusterUsers, []models.ClusterProjects, error) }
Fetcher is the interface resource manager has to implement.
type Manager ¶
Manager implements the interface to fetch compute units from different resource managers.
func (Manager) FetchUnits ¶
func (b Manager) FetchUnits(ctx context.Context, start time.Time, end time.Time) ([]models.ClusterUnits, error)
FetchUnits implements collection jobs between start and end times.
func (Manager) FetchUsersProjects ¶
func (b Manager) FetchUsersProjects(ctx context.Context, currentTime time.Time) ([]models.ClusterUsers, []models.ClusterProjects, error)
FetchUsersProjects fetches latest projects and users for each cluster.
Click to show internal directories.
Click to hide internal directories.