package oclib import ( "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/resources/data" "cloud.o-forge.io/core/oc-lib/models/resources/datacenter" "cloud.o-forge.io/core/oc-lib/models/resources/processing" "cloud.o-forge.io/core/oc-lib/models/resources/storage" "cloud.o-forge.io/core/oc-lib/models/utils" "cloud.o-forge.io/core/oc-lib/models/workflow/graph" ) const WORKFLOW = "workflow" type Workflow struct { resources.AbstractResource Graph graph.Graph `bson:"graph,omitempty" json:"graph,omitempty"` Datas map[string]data.Data `bson:"datas,omitempty" json:"datas,omitempty"` Storages map[string]storage.Storage `bson:"storages,omitempty" json:"storages,omitempty"` Processing map[string]processing.Processing `bson:"processing,omitempty" json:"processing,omitempty"` Datacenters map[string]datacenter.Datacenter `bson:"datacenters,omitempty" json:"datacenters,omitempty"` Schedule WorkflowSchedule `bson:"schedule,omitempty" json:"schedule,omitempty"` } func (d *Workflow) GetAccessor(driver utils.Driver) utils.Accessor { var data utils.Accessor switch driver { case utils.MONGO: data = &WorkflowMongoAccessor{} default: data = &WorkflowMongoAccessor{} } data.SetLogger() return data } func (w *Workflow) isDCLink(link graph.GraphLink) bool { if _, exists := w.Datacenters[link.Destination.ID]; exists { return true } else if _, exists := w.Datacenters[link.Source.ID]; exists { return true } return false }