This commit is contained in:
mr 2024-11-07 12:39:28 +01:00
parent 2d249f38ff
commit e6ca520a88
4 changed files with 23 additions and 20 deletions

View File

@ -9,21 +9,23 @@ import (
) )
type TechnologyEnum int type TechnologyEnum int
const(
const (
DOCKER TechnologyEnum = iota DOCKER TechnologyEnum = iota
KUBERNETES, KUBERNETES
SLURM, SLURM
HW, HW
CONDOR CONDOR
) )
type AccessEnum int type AccessEnum int
const(
const (
SSH AccessEnum = iota SSH AccessEnum = iota
SSH_KUBE_API, SSH_KUBE_API
SSH_SLURM, SSH_SLURM
SSH_DOCKER, SSH_DOCKER
OPENCLOUD, OPENCLOUD
VPN VPN
) )
@ -33,11 +35,11 @@ const(
*/ */
type ComputeResource struct { type ComputeResource struct {
resource_model.AbstractResource resource_model.AbstractResource
Technology TechnologyEnum `json:"technology,omitempty" bson:"technology,omitempty"` // Technology is the technology Technology TechnologyEnum `json:"technology,omitempty" bson:"technology,omitempty"` // Technology is the technology
Architecture string `json:"architecture,omitempty" bson:"architecture,omitempty"` // Architecture is the architecture Architecture string `json:"architecture,omitempty" bson:"architecture,omitempty"` // Architecture is the architecture
Access AccessEnum `json:"access,omitempty" bson:"access,omitempty"` // Access is the access Access AccessEnum `json:"access,omitempty" bson:"access,omitempty"` // Access is the access
Localisation string `json:"localisation,omitempty" bson:"localisation,omitempty"` // Localisation is the localisation Localisation string `json:"localisation,omitempty" bson:"localisation,omitempty"` // Localisation is the localisation
CPUs []*CPU `bson:"cpus,omitempty" json:"cpus,omitempty"` // CPUs is the list of CPUs CPUs []*CPU `bson:"cpus,omitempty" json:"cpus,omitempty"` // CPUs is the list of CPUs
RAM *RAM `bson:"ram,omitempty" json:"ram,omitempty"` // RAM is the RAM RAM *RAM `bson:"ram,omitempty" json:"ram,omitempty"` // RAM is the RAM

View File

@ -35,7 +35,7 @@ func (dca *computeMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject,
} }
func (dca *computeMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) { func (dca *computeMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
return dca.computeMongoAccessor(data, dca) return dca.GenericStoreOne(data, dca)
} }
func (dca *computeMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) { func (dca *computeMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {

View File

@ -12,7 +12,7 @@ import (
func TestStoreOneData(t *testing.T) { func TestStoreOneData(t *testing.T) {
d := DataResource{ d := DataResource{
WebResource: resource_model.WebResource{ WebResource: resource_model.WebResource{
Type: "jpeg", Protocol: "http", Path: "azerty.fr", Protocol: "http", Path: "azerty.fr",
}, },
Example: "123456", Example: "123456",
AbstractResource: resource_model.AbstractResource{ AbstractResource: resource_model.AbstractResource{
@ -34,7 +34,7 @@ func TestStoreOneData(t *testing.T) {
func TestLoadOneDate(t *testing.T) { func TestLoadOneDate(t *testing.T) {
d := DataResource{ d := DataResource{
WebResource: resource_model.WebResource{ WebResource: resource_model.WebResource{
Type: "jpeg", Protocol: "http", Path: "azerty.fr", Protocol: "http", Path: "azerty.fr",
}, },
Example: "123456", Example: "123456",
AbstractResource: resource_model.AbstractResource{ AbstractResource: resource_model.AbstractResource{

View File

@ -8,11 +8,11 @@ import (
"cloud.o-forge.io/core/oc-lib/tools" "cloud.o-forge.io/core/oc-lib/tools"
) )
type StorageType int type StorageSize int
// StorageType - Enum that defines the type of storage // StorageType - Enum that defines the type of storage
const ( const (
GB StorageType = iota GB StorageSize = iota
MB MB
KB KB
) )
@ -30,6 +30,7 @@ func (dma StorageType) ToArgo() string {
// enum of a data type // enum of a data type
type StorageType int type StorageType int
const ( const (
FILE = iota FILE = iota
STREAM STREAM
@ -47,9 +48,9 @@ const (
type StorageResource struct { type StorageResource struct {
resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name) resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name)
resource_model.WebResource resource_model.WebResource
Type DataType `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage Type StorageType `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage
SizeType StorageType `bson:"size_type" json:"size_type" default:"0"` // SizeType is the type of the storage size SizeType StorageSize `bson:"size_type" json:"size_type" default:"0"` // SizeType is the type of the storage size
Size uint `bson:"size,omitempty" json:"size,omitempty"` // Size is the size of the storage Size uint `bson:"size,omitempty" json:"size,omitempty"` // Size is the size of the storage
Local bool `bson:"local" json:"local"` // Local is a flag that indicates if the storage is local Local bool `bson:"local" json:"local"` // Local is a flag that indicates if the storage is local
Encryption bool `bson:"encryption,omitempty" json:"encryption,omitempty"` // Encryption is a flag that indicates if the storage is encrypted Encryption bool `bson:"encryption,omitempty" json:"encryption,omitempty"` // Encryption is a flag that indicates if the storage is encrypted