github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/resource/manager.go (about)

     1  package resource
     2  
     3  import (
     4  	"context"
     5  
     6  	enginetypes "github.com/projecteru2/core/engine/types"
     7  	plugintypes "github.com/projecteru2/core/resource/plugins/types"
     8  	resourcetypes "github.com/projecteru2/core/resource/types"
     9  	"github.com/projecteru2/core/types"
    10  )
    11  
    12  // Manager indicate manages
    13  // coretypes --> manager to rawparams --> plugins types
    14  type Manager interface {
    15  	AddNode(context.Context, string, resourcetypes.Resources, *enginetypes.Info) (resourcetypes.Resources, error)
    16  	RemoveNode(context.Context, string) error
    17  	GetNodesDeployCapacity(context.Context, []string, resourcetypes.Resources) (map[string]*plugintypes.NodeDeployCapacity, int, error)
    18  	SetNodeResourceCapacity(context.Context, string, resourcetypes.Resources, resourcetypes.Resources, bool, bool) (resourcetypes.Resources, resourcetypes.Resources, error)
    19  	SetNodeResourceUsage(context.Context, string, resourcetypes.Resources, resourcetypes.Resources, []resourcetypes.Resources, bool, bool) (resourcetypes.Resources, resourcetypes.Resources, error)
    20  	GetNodeResourceInfo(context.Context, string, []*types.Workload, bool) (resourcetypes.Resources, resourcetypes.Resources, []string, error)
    21  	GetMostIdleNode(context.Context, []string) (string, error)
    22  
    23  	Alloc(context.Context, string, int, resourcetypes.Resources) ([]resourcetypes.Resources, []resourcetypes.Resources, error)
    24  	RollbackAlloc(context.Context, string, []resourcetypes.Resources) error
    25  	Realloc(context.Context, string, resourcetypes.Resources, resourcetypes.Resources) (resourcetypes.Resources, resourcetypes.Resources, resourcetypes.Resources, error)
    26  	RollbackRealloc(context.Context, string, resourcetypes.Resources) error
    27  	Remap(context.Context, string, []*types.Workload) (map[string]resourcetypes.Resources, error)
    28  
    29  	GetNodeMetrics(context.Context, *types.Node) ([]*plugintypes.Metrics, error)
    30  	GetMetricsDescription(context.Context) ([]*plugintypes.MetricsDescription, error)
    31  }