Payment Flow + Access Flow Change
This commit is contained in:
@@ -145,6 +145,50 @@ func (g *Graph) GetAverageTimeProcessingBeforeStart(average float64, processingI
|
||||
return max, nil
|
||||
}
|
||||
|
||||
// DataStorageLink represents a resolved Data→Storage pair found in the graph.
|
||||
type DataStorageLink struct {
|
||||
DataItemID string
|
||||
StorageItemID string
|
||||
}
|
||||
|
||||
// GetDataStorageLinks returns all links that connect a Data item to a Storage item.
|
||||
// These links are mandatory when the Data instance has a Source configured:
|
||||
// the workflow builder uses them to know where to download the data before
|
||||
// any processing step that consumes that storage.
|
||||
func (g *Graph) GetDataStorageLinks() []DataStorageLink {
|
||||
var result []DataStorageLink
|
||||
for _, link := range g.Links {
|
||||
srcItem, srcOk := g.Items[link.Source.ID]
|
||||
dstItem, dstOk := g.Items[link.Destination.ID]
|
||||
if !srcOk || !dstOk {
|
||||
continue
|
||||
}
|
||||
if g.IsData(srcItem) && g.IsStorage(dstItem) {
|
||||
result = append(result, DataStorageLink{
|
||||
DataItemID: link.Source.ID,
|
||||
StorageItemID: link.Destination.ID,
|
||||
})
|
||||
} else if g.IsStorage(srcItem) && g.IsData(dstItem) {
|
||||
result = append(result, DataStorageLink{
|
||||
DataItemID: link.Destination.ID,
|
||||
StorageItemID: link.Source.ID,
|
||||
})
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// GetLinkedStorageForData returns the storage item IDs linked to a given Data item.
|
||||
func (g *Graph) GetLinkedStorageForData(dataItemID string) []string {
|
||||
var storageIDs []string
|
||||
for _, dsl := range g.GetDataStorageLinks() {
|
||||
if dsl.DataItemID == dataItemID {
|
||||
storageIDs = append(storageIDs, dsl.StorageItemID)
|
||||
}
|
||||
}
|
||||
return storageIDs
|
||||
}
|
||||
|
||||
func (g *Graph) GetResource(id string) (tools.DataType, resources.ResourceInterface) {
|
||||
if item, ok := g.Items[id]; ok {
|
||||
if item.NativeTool != nil {
|
||||
|
||||
@@ -15,32 +15,32 @@ type GraphItem struct {
|
||||
}
|
||||
|
||||
func (g *GraphItem) GetResource() (tools.DataType, resources.ResourceInterface) {
|
||||
if g.Data != nil {
|
||||
return tools.DATA_RESOURCE, g.Data
|
||||
} else if g.Compute != nil {
|
||||
return tools.COMPUTE_RESOURCE, g.Compute
|
||||
} else if g.Workflow != nil {
|
||||
return tools.WORKFLOW_RESOURCE, g.Workflow
|
||||
} else if g.Processing != nil {
|
||||
return tools.PROCESSING_RESOURCE, g.Processing
|
||||
} else if g.Storage != nil {
|
||||
return tools.STORAGE_RESOURCE, g.Storage
|
||||
} else if g.NativeTool != nil {
|
||||
return tools.NATIVE_TOOL, g.NativeTool
|
||||
} else if g.Service != nil {
|
||||
return tools.SERVICE_RESOURCE, g.Service
|
||||
} else if g.Dynamic != nil {
|
||||
return tools.DYNAMIC_RESOURCE, g.Dynamic
|
||||
if g.ItemResource.Data != nil {
|
||||
return tools.DATA_RESOURCE, g.ItemResource.Data
|
||||
} else if g.ItemResource.Compute != nil {
|
||||
return tools.COMPUTE_RESOURCE, g.ItemResource.Compute
|
||||
} else if g.ItemResource.Workflow != nil {
|
||||
return tools.WORKFLOW_RESOURCE, g.ItemResource.Workflow
|
||||
} else if g.ItemResource.Processing != nil {
|
||||
return tools.PROCESSING_RESOURCE, g.ItemResource.Processing
|
||||
} else if g.ItemResource.Storage != nil {
|
||||
return tools.STORAGE_RESOURCE, g.ItemResource.Storage
|
||||
} else if g.ItemResource.NativeTool != nil {
|
||||
return tools.NATIVE_TOOL, g.ItemResource.NativeTool
|
||||
} else if g.ItemResource.Service != nil {
|
||||
return tools.SERVICE_RESOURCE, g.ItemResource.Service
|
||||
} else if g.ItemResource.Dynamic != nil {
|
||||
return tools.DYNAMIC_RESOURCE, g.ItemResource.Dynamic
|
||||
}
|
||||
return tools.INVALID, nil
|
||||
}
|
||||
|
||||
func (g *GraphItem) Clear() {
|
||||
g.Data = nil
|
||||
g.Compute = nil
|
||||
g.Workflow = nil
|
||||
g.Processing = nil
|
||||
g.Storage = nil
|
||||
g.Service = nil
|
||||
g.Dynamic = nil
|
||||
g.ItemResource.Data = nil
|
||||
g.ItemResource.Compute = nil
|
||||
g.ItemResource.Workflow = nil
|
||||
g.ItemResource.Processing = nil
|
||||
g.ItemResource.Storage = nil
|
||||
g.ItemResource.Service = nil
|
||||
g.ItemResource.Dynamic = nil
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ func (l *GraphLink) IsComputeLink(g Graph) (bool, string) {
|
||||
if g.Items == nil {
|
||||
return false, ""
|
||||
}
|
||||
if d, ok := g.Items[l.Source.ID]; ok && d.Compute != nil {
|
||||
return true, d.Compute.UUID
|
||||
if d, ok := g.Items[l.Source.ID]; ok && d.ItemResource.Compute != nil {
|
||||
return true, d.ItemResource.Compute.UUID
|
||||
}
|
||||
if d, ok := g.Items[l.Destination.ID]; ok && d.Compute != nil {
|
||||
return true, d.Compute.UUID
|
||||
if d, ok := g.Items[l.Destination.ID]; ok && d.ItemResource.Compute != nil {
|
||||
return true, d.ItemResource.Compute.UUID
|
||||
}
|
||||
return false, ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user