github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/resource/plugins/binary/calculate.go (about) 1 package binary 2 3 import ( 4 "context" 5 6 binarytypes "github.com/projecteru2/core/resource/plugins/binary/types" 7 plugintypes "github.com/projecteru2/core/resource/plugins/types" 8 ) 9 10 // CalculateDeploy . 11 func (p Plugin) CalculateDeploy(ctx context.Context, nodename string, deployCount int, resourceRequest plugintypes.WorkloadResourceRequest) (*plugintypes.CalculateDeployResponse, error) { 12 req := &binarytypes.CalculateDeployRequest{ 13 Nodename: nodename, 14 DeployCount: deployCount, 15 WorkloadResourceRequest: resourceRequest, 16 } 17 resp := &plugintypes.CalculateDeployResponse{} 18 return resp, p.call(ctx, CalculateDeployCommand, req, resp) 19 } 20 21 // CalculateRealloc . 22 func (p Plugin) CalculateRealloc(ctx context.Context, nodename string, resource plugintypes.WorkloadResource, resourceRequest plugintypes.WorkloadResourceRequest) (*plugintypes.CalculateReallocResponse, error) { 23 req := &binarytypes.CalculateReallocRequest{ 24 Nodename: nodename, 25 WorkloadResource: resource, 26 WorkloadResourceRequest: resourceRequest, 27 } 28 resp := &plugintypes.CalculateReallocResponse{} 29 return resp, p.call(ctx, CalculateReallocCommand, req, resp) 30 } 31 32 // CalculateRemap . 33 func (p Plugin) CalculateRemap(ctx context.Context, nodename string, workloadsResource map[string]plugintypes.WorkloadResource) (*plugintypes.CalculateRemapResponse, error) { 34 req := &binarytypes.CalculateRemapRequest{ 35 Nodename: nodename, 36 WorkloadsResource: workloadsResource, 37 } 38 resp := &plugintypes.CalculateRemapResponse{} 39 return resp, p.call(ctx, CalculateRemapCommand, req, resp) 40 }