summaryrefslogtreecommitdiff
path: root/Omni/Agent/Core.hs
blob: 2d09e3955b2a7033e6bb1c698076591f518cbebf (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
33
34
35
36
37
{-# 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
  | -- | Task ID
    Working Text
  | -- | Task ID
    Submitting Text
  | -- | Error message
    Error Text
  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