lightest + clearest code
This commit is contained in:
		@@ -5,10 +5,8 @@ import (
 | 
			
		||||
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/models/peer"
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/models/resources"
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/models/resources/compute"
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/models/resources/storage"
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/models/resources/workflow/graph"
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/models/utils"
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/models/workflow/graph"
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/tools"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -35,8 +33,8 @@ func (w *AbstractWorkflow) GetWorkflows() (list_computings []graph.GraphItem) {
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w *AbstractWorkflow) GetComputeByRelatedProcessing(processingID string) []*compute.ComputeResource {
 | 
			
		||||
	storages := []*compute.ComputeResource{}
 | 
			
		||||
func (w *AbstractWorkflow) GetComputeByRelatedProcessing(processingID string) []*resources.ComputeResource {
 | 
			
		||||
	storages := []*resources.ComputeResource{}
 | 
			
		||||
	for _, link := range w.Graph.Links {
 | 
			
		||||
		nodeID := link.Destination.ID                 // we considers that the processing is the destination
 | 
			
		||||
		node := w.Graph.Items[link.Source.ID].Compute // we are looking for the storage as source
 | 
			
		||||
@@ -51,8 +49,8 @@ func (w *AbstractWorkflow) GetComputeByRelatedProcessing(processingID string) []
 | 
			
		||||
	return storages
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (w *AbstractWorkflow) GetStoragesByRelatedProcessing(processingID string) []*storage.StorageResource {
 | 
			
		||||
	storages := []*storage.StorageResource{}
 | 
			
		||||
func (w *AbstractWorkflow) GetStoragesByRelatedProcessing(processingID string) []*resources.StorageResource {
 | 
			
		||||
	storages := []*resources.StorageResource{}
 | 
			
		||||
	for _, link := range w.Graph.Links {
 | 
			
		||||
		nodeID := link.Destination.ID                 // we considers that the processing is the destination
 | 
			
		||||
		node := w.Graph.Items[link.Source.ID].Storage // we are looking for the storage as source
 | 
			
		||||
@@ -107,7 +105,7 @@ func (wfa *Workflow) CheckBooking(caller *tools.HTTPCaller) (bool, error) {
 | 
			
		||||
	if wfa.Graph == nil { // no graph no booking
 | 
			
		||||
		return false, nil
 | 
			
		||||
	}
 | 
			
		||||
	accessor := (&compute.ComputeResource{}).GetAccessor("", []string{}, caller)
 | 
			
		||||
	accessor := (&resources.ComputeResource{}).GetAccessor("", []string{}, caller)
 | 
			
		||||
	for _, link := range wfa.Graph.Links {
 | 
			
		||||
		if ok, dc_id := wfa.isDCLink(link); ok { // check if the link is a link between a compute and a resource
 | 
			
		||||
			dc, code, _ := accessor.LoadOne(dc_id)
 | 
			
		||||
@@ -115,7 +113,7 @@ func (wfa *Workflow) CheckBooking(caller *tools.HTTPCaller) (bool, error) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			// CHECK BOOKING ON PEER, compute could be a remote one
 | 
			
		||||
			peerID := dc.(*compute.ComputeResource).PeerID
 | 
			
		||||
			peerID := dc.(*resources.ComputeResource).PeerID
 | 
			
		||||
			if peerID == "" {
 | 
			
		||||
				return false, errors.New("no peer id")
 | 
			
		||||
			} // no peer id no booking, we need to know where to book
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user