summaryrefslogtreecommitdiff
path: root/Omni/Agent/Core.hs
blob: 394b357d3f7786ce7fc477ab37cae4cfa7aea140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{-# LANGUAGE DeriveGeneric #-}
{-# 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