diff --git a/models/resources/storage.go b/models/resources/storage.go index c429dc7..8cb0d4a 100755 --- a/models/resources/storage.go +++ b/models/resources/storage.go @@ -12,6 +12,17 @@ import ( "github.com/google/uuid" ) +// EmbeddedStorageSelection records which storage capability was activated on a +// compute unit graph node, and which pricing options were selected for it. +// Key in WorkflowExecution.SelectedEmbeddedStorages is the compute graph node ID. +// A nil/absent entry means no storage was activated on that compute unit. +type EmbeddedStorageSelection struct { + StorageIndex int `json:"storage_index" bson:"storage_index"` // index in ComputeResourceInstance.AvailableStorages + PartnershipIndex int `json:"partnership_index" bson:"partnership_index"` // index in the storage's partnerships + BuyingIndex int `json:"buying_index" bson:"buying_index"` + StrategyIndex int `json:"strategy_index" bson:"strategy_index"` +} + /* * StorageResource is a struct that represents a storage resource * it defines the resource storage diff --git a/models/workflow/workflow.go b/models/workflow/workflow.go index d72e93f..4c07556 100644 --- a/models/workflow/workflow.go +++ b/models/workflow/workflow.go @@ -47,11 +47,12 @@ type Workflow struct { // Schedule *WorkflowSchedule `bson:"schedule,omitempty" json:"schedule,omitempty"` // Schedule is the schedule of the workflow Shared []string `json:"shared,omitempty" bson:"shared,omitempty"` // Shared is the ID of the shared workflow // AbstractWorkflow contains the basic fields of a workflow - Env map[string][]models.Param `json:"env" bson:"env"` - Inputs map[string][]models.Param `json:"inputs" bson:"inputs"` - Outputs map[string][]models.Param `json:"outputs" bson:"outputs"` - Args map[string][]string `json:"args" bson:"args"` - Exposes map[string][]models.Expose `bson:"exposes" json:"exposes"` // Expose is the execution + Env map[string][]models.Param `json:"env" bson:"env"` + Inputs map[string][]models.Param `json:"inputs" bson:"inputs"` + Outputs map[string][]models.Param `json:"outputs" bson:"outputs"` + Args map[string][]string `json:"args" bson:"args"` + Exposes map[string][]models.Expose `bson:"exposes" json:"exposes"` // Expose is the execution + SelectedEmbeddedStorages map[string]*resources.EmbeddedStorageSelection `json:"selected_embedded_storages,omitempty"` } func (d *Workflow) GetAccessor(request *tools.APIRequest) utils.Accessor { diff --git a/models/workflow_execution/workflow_execution.go b/models/workflow_execution/workflow_execution.go index 62c53f1..fa44580 100755 --- a/models/workflow_execution/workflow_execution.go +++ b/models/workflow_execution/workflow_execution.go @@ -9,6 +9,7 @@ import ( "cloud.o-forge.io/core/oc-lib/models/booking" "cloud.o-forge.io/core/oc-lib/models/common/enum" "cloud.o-forge.io/core/oc-lib/models/common/pricing" + "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/resources/purchase_resource" "cloud.o-forge.io/core/oc-lib/models/utils" "cloud.o-forge.io/core/oc-lib/models/workflow" @@ -17,17 +18,6 @@ import ( "go.mongodb.org/mongo-driver/bson/primitive" ) -// EmbeddedStorageSelection records which storage capability was activated on a -// compute unit graph node, and which pricing options were selected for it. -// Key in WorkflowExecution.SelectedEmbeddedStorages is the compute graph node ID. -// A nil/absent entry means no storage was activated on that compute unit. -type EmbeddedStorageSelection struct { - StorageIndex int `json:"storage_index" bson:"storage_index"` // index in ComputeResourceInstance.AvailableStorages - PartnershipIndex int `json:"partnership_index" bson:"partnership_index"` // index in the storage's partnerships - BuyingIndex int `json:"buying_index" bson:"buying_index"` - StrategyIndex int `json:"strategy_index" bson:"strategy_index"` -} - // BookingState tracks the reservation and completion status of a single booking // within a workflow execution. // - IsBooked: true while the resource is actively reserved (set on WORKFLOW_STARTED_EVENT, @@ -71,7 +61,7 @@ type WorkflowExecution struct { // SelectedEmbeddedStorages records which storage capability was activated on // each compute unit graph node (key = compute graph node ID). // Populated by oc-scheduler, consumed by oc-monitord's argo builder. - SelectedEmbeddedStorages map[string]*EmbeddedStorageSelection `json:"selected_embedded_storages,omitempty" bson:"selected_embedded_storages,omitempty"` + SelectedEmbeddedStorages map[string]*resources.EmbeddedStorageSelection `json:"selected_embedded_storages,omitempty" bson:"selected_embedded_storages,omitempty"` } func (ri *WorkflowExecution) Extend(typ ...string) map[string][]tools.DataType {