summaryrefslogtreecommitdiff
path: root/Omni/Agent/Core.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Agent/Core.hs')
-rw-r--r--Omni/Agent/Core.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Omni/Agent/Core.hs b/Omni/Agent/Core.hs
new file mode 100644
index 0000000..7299d51
--- /dev/null
+++ b/Omni/Agent/Core.hs
@@ -0,0 +1,33 @@
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+-- : out omni-agent-core
+module Omni.Agent.Core where
+
+import Alpha
+import Data.Aeson (FromJSON, ToJSON)
+
+-- | Status of a worker agent
+data WorkerStatus
+ = Idle
+ | Syncing
+ | Working Text -- ^ Task ID
+ | Submitting Text -- ^ Task ID
+ | Error Text -- ^ Error message
+ deriving (Show, Eq, Generic)
+
+instance ToJSON WorkerStatus
+instance FromJSON WorkerStatus
+
+-- | Representation of a worker agent
+data Worker = Worker
+ { workerName :: Text
+ , workerPid :: Maybe Int
+ , workerStatus :: WorkerStatus
+ , workerPath :: FilePath
+ }
+ deriving (Show, Eq, Generic)
+
+instance ToJSON Worker
+instance FromJSON Worker