chore(jobsystem): add ressource model representation
This commit is contained in:
parent
c81bc149a9
commit
ac1e272fb5
@ -4,6 +4,7 @@
|
||||
JobMeta
|
||||
occurrence JobOccurrence -- When should the job be executed?
|
||||
-- (Possibly recurring)
|
||||
ressources JobRessources
|
||||
deriving Eq Ord Show Generic
|
||||
|
||||
-- Actual job to be fetched and executed by the workers
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
module Model.Types.Jobsystem
|
||||
( JobOccurrence(..)
|
||||
, JobRessource(..), JobRessources(..)
|
||||
) where
|
||||
|
||||
import Import.NoModel
|
||||
@ -16,3 +17,25 @@ deriveJSON defaultOptions
|
||||
, unwrapUnaryRecords = True
|
||||
} ''JobOccurrence
|
||||
derivePersistFieldJSON ''JobOccurrence
|
||||
|
||||
|
||||
data JobRessource
|
||||
= JobResCPU
|
||||
| JobResMemory
|
||||
| JobResPrinter
|
||||
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic)
|
||||
deriving anyclass (Universe, Finite, NFData)
|
||||
|
||||
nullaryPathPiece ''JobRessource $ camelToPathPiece' 2
|
||||
pathPieceJSON ''JobRessource
|
||||
pathPieceJSONKey ''JobRessource
|
||||
|
||||
newtype JobRessources = JobRessources { jobRessources :: Map JobRessource Double }
|
||||
deriving (Eq, Ord, Read, Show, Generic)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
deriveJSON defaultOptions
|
||||
{ tagSingleConstructors = False
|
||||
, unwrapUnaryRecords = True
|
||||
} ''JobRessources
|
||||
derivePersistFieldJSON ''JobRessources
|
||||
|
||||
Reference in New Issue
Block a user