From d00109daf3ca449c9661a567d09293476aff584e Mon Sep 17 00:00:00 2001 From: mr Date: Fri, 17 Jan 2025 10:55:06 +0100 Subject: [PATCH] light modification --- models/resources/data.go | 17 ++++++++--------- models/resources/storage.go | 14 +++++++++++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/models/resources/data.go b/models/resources/data.go index 5ce7b87..cdde900 100644 --- a/models/resources/data.go +++ b/models/resources/data.go @@ -9,15 +9,6 @@ import ( "cloud.o-forge.io/core/oc-lib/tools" ) -// enum of public private or licenced data -type DataLicense int - -const ( - PUBLIC DataLicense = iota - PRIVATE - LICENCED -) - /* * DataResource is a struct that represents a data resource * it defines the resource data @@ -70,6 +61,14 @@ const ( PER_KB_DOWNLOADED ) +func (t DataResourcePricingStrategy) String() string { + return [...]string{"PER DOWNLOAD", "PER TB DOWNLOADED", "PER GB DOWNLOADED", "PER MB DOWNLOADED", "PER KB DOWNLOADED"}[t] +} + +func DataResourcePricingStrategyList() []DataResourcePricingStrategy { + return []DataResourcePricingStrategy{PER_DOWNLOAD, PER_TB_DOWNLOADED, PER_GB_DOWNLOADED, PER_MB_DOWNLOADED, PER_KB_DOWNLOADED} +} + func ToDataResourcePricingStrategy(i int) DataResourcePricingStrategy { return DataResourcePricingStrategy(i) } diff --git a/models/resources/storage.go b/models/resources/storage.go index 9724645..1041956 100644 --- a/models/resources/storage.go +++ b/models/resources/storage.go @@ -66,8 +66,12 @@ const ( GARANTED_STORAGE ) +func PrivilegeStoragePricingStrategyList() []PrivilegeStoragePricingStrategy { + return []PrivilegeStoragePricingStrategy{BASIC_STORAGE, GARANTED_ON_DELAY_STORAGE, GARANTED_STORAGE} +} + func (t PrivilegeStoragePricingStrategy) String() string { - return [...]string{"BASIC_STORAGE", "GARANTED_ON_DELAY_STORAGE", "GARANTED_STORAGE"}[t] + return [...]string{"NO MEMORY HOLDING", "KEEPED ON MEMORY GARANTED DURING DELAY", "KEEPED ON MEMORY GARANTED"}[t] } type StorageResourcePricingStrategy int @@ -80,6 +84,14 @@ const ( PER_KB_STORED ) +func StorageResourcePricingStrategyList() []StorageResourcePricingStrategy { + return []StorageResourcePricingStrategy{PER_DATA_STORED, PER_TB_STORED, PER_GB_STORED, PER_MB_STORED, PER_KB_STORED} +} + +func (t StorageResourcePricingStrategy) String() string { + return [...]string{"PER DATA STORED", "PER TB STORED", "PER GB STORED", "PER MB STORED", "PER KB STORED"}[t] +} + func (t StorageResourcePricingStrategy) GetStrategy() string { return [...]string{"PER_DATA_STORED", "PER_GB_STORED", "PER_MB_STORED", "PER_KB_STORED"}[t] }