summaryrefslogtreecommitdiff
path: root/src/Network.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network.hs')
-rw-r--r--src/Network.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Network.hs b/src/Network.hs
new file mode 100644
index 0000000..633db16
--- /dev/null
+++ b/src/Network.hs
@@ -0,0 +1,33 @@
+module Network (
+ Network(..),
+ Node(..),
+ NodeName(..), textNodeName, unpackNodeName,
+) where
+
+import Control.Concurrent
+
+import Data.Text (Text)
+import Data.Text qualified as T
+
+import Process
+
+data Network = Network
+ { netNodes :: MVar [Node]
+ , netProcesses :: MVar [Process]
+ , netDir :: FilePath
+ }
+
+data Node = Node
+ { nodeName :: NodeName
+ , nodeNetwork :: Network
+ , nodeDir :: FilePath
+ }
+
+newtype NodeName = NodeName Text
+ deriving (Eq, Ord)
+
+textNodeName :: NodeName -> Text
+textNodeName (NodeName name) = name
+
+unpackNodeName :: NodeName -> String
+unpackNodeName (NodeName tname) = T.unpack tname