improving documentation
This commit is contained in:
@@ -15,7 +15,7 @@ import Error
|
|||||||
)
|
)
|
||||||
|
|
||||||
import JSON
|
import JSON
|
||||||
( IPAdressTable
|
( IPAdressTable(..)
|
||||||
, MapPortResponse(..)
|
, MapPortResponse(..)
|
||||||
, P2prcConfig
|
, P2prcConfig
|
||||||
)
|
)
|
||||||
@@ -33,21 +33,16 @@ import CLI
|
|||||||
import Environment ( cleanEnvironment )
|
import Environment ( cleanEnvironment )
|
||||||
|
|
||||||
|
|
||||||
|
data P2PRCapi -- ^ Haskell API
|
||||||
{- |
|
= MkP2PRCapi -- ^ Main Constructor
|
||||||
|
{ startServer :: IOEitherError ProcessHandle -- ^ start server
|
||||||
Haskell API
|
, execInitConfig :: IOEitherError P2prcConfig
|
||||||
|
, execListServers :: IOEitherError IPAdressTable
|
||||||
-}
|
, execMapPort :: MapPortRequest -> IOEitherError MapPortResponse
|
||||||
data P2PRCapi = MkP2PRCapi
|
}
|
||||||
{ startServer :: IOEitherError ProcessHandle
|
|
||||||
, execInitConfig :: IOEitherError P2prcConfig
|
|
||||||
, execListServers :: IOEitherError IPAdressTable
|
|
||||||
, execMapPort :: MapPortRequest -> IOEitherError MapPortResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-- | This type defines the request required to create an association between a TCP socket port and a DNS server in the network. If successful, it makes a resource available in the network.
|
-- | This defines the request required to create an association between a TCP socket port and a DNS server in the network. If successful, it makes a resource available in the network.
|
||||||
data MapPortRequest =
|
data MapPortRequest =
|
||||||
MkMapPortRequest -- ^ P2PRC's port allocation request value
|
MkMapPortRequest -- ^ P2PRC's port allocation request value
|
||||||
Int -- ^ TCP socket number
|
Int -- ^ TCP socket number
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ import API
|
|||||||
)
|
)
|
||||||
@
|
@
|
||||||
-}
|
-}
|
||||||
runP2PRC :: MapPortRequest -> IO ()
|
runP2PRC
|
||||||
|
:: MapPortRequest -- ^ TCP Port Request
|
||||||
|
-> IO ()
|
||||||
runP2PRC (MkMapPortRequest portNumber domainName) = do
|
runP2PRC (MkMapPortRequest portNumber domainName) = do
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module JSON
|
module JSON
|
||||||
( P2prcConfig
|
( P2prcConfig(..)
|
||||||
, IPAdressTable
|
, IPAdressTable(..)
|
||||||
|
, IPAddress(..)
|
||||||
|
, ServerInfo(..)
|
||||||
, MapPortResponse(..)
|
, MapPortResponse(..)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
@@ -17,7 +19,7 @@ import Data.Aeson
|
|||||||
|
|
||||||
-- {-# WARNING MapPortResponse "This newtype is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-}
|
-- {-# WARNING MapPortResponse "This newtype is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-}
|
||||||
|
|
||||||
-- ^ This newtype represents P2PRC's response to the TCP port and DNS address allocation. This value will confirm the successful allocation and return information about it.
|
-- ^ This represents P2PRC's response to the TCP port and DNS address allocation. This value will confirm the successful allocation and return information about it.
|
||||||
newtype MapPortResponse
|
newtype MapPortResponse
|
||||||
= MkMapPortResponse -- ^ Allocation information value
|
= MkMapPortResponse -- ^ Allocation information value
|
||||||
String -- ^ Column separated Host's IP address and Port String
|
String -- ^ Column separated Host's IP address and Port String
|
||||||
@@ -37,31 +39,31 @@ instance FromJSON MapPortResponse where
|
|||||||
|
|
||||||
|
|
||||||
{-# WARNING P2prcConfig "This type is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-}
|
{-# WARNING P2prcConfig "This type is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-}
|
||||||
-- | Host P2prc configuration
|
newtype P2prcConfig -- ^ Host P2prc configuration
|
||||||
newtype P2prcConfig = MkP2prConfig
|
= MkP2prConfig -- ^ Unique Constructor
|
||||||
{ machineName :: String
|
{ machineName :: String -- ^ Machine Name
|
||||||
-- , iPTable :: String -- File
|
}
|
||||||
-- , dockerContainers :: String -- Directory
|
deriving Show
|
||||||
-- , defaultDockerFile :: String -- Directory
|
-- , iPTable :: String -- File
|
||||||
-- , dockerRunLogs :: String -- Directory
|
-- , dockerContainers :: String -- Directory
|
||||||
-- , speedTestFile :: String -- File
|
-- , defaultDockerFile :: String -- Directory
|
||||||
-- , iPV6Address :: Maybe String
|
-- , dockerRunLogs :: String -- Directory
|
||||||
-- , pluginPath :: String -- Directory
|
-- , speedTestFile :: String -- File
|
||||||
-- , trackContainersPath :: String -- File
|
-- , iPV6Address :: Maybe String
|
||||||
-- , hostServerPort :: Int
|
-- , pluginPath :: String -- Directory
|
||||||
-- , proxyPort :: Maybe Int
|
-- , trackContainersPath :: String -- File
|
||||||
-- , groupTrackContainersPath :: File
|
-- , hostServerPort :: Int
|
||||||
-- , fRPServerPort :: Bool
|
-- , proxyPort :: Maybe Int
|
||||||
-- , behindNAT :: Bool
|
-- , groupTrackContainersPath :: File
|
||||||
-- , iPTableKey :: String
|
-- , fRPServerPort :: Bool
|
||||||
-- , publicKeyFile :: String -- File
|
-- , behindNAT :: Bool
|
||||||
-- , privateKeyFile :: String -- File
|
-- , iPTableKey :: String
|
||||||
-- , pemFile :: String -- File
|
-- , publicKeyFile :: String -- File
|
||||||
-- , keyFile :: String -- File
|
-- , privateKeyFile :: String -- File
|
||||||
-- , bareMetal :: Bool
|
-- , pemFile :: String -- File
|
||||||
-- , customConfig
|
-- , keyFile :: String -- File
|
||||||
}
|
-- , bareMetal :: Bool
|
||||||
deriving Show
|
-- , customConfig
|
||||||
|
|
||||||
|
|
||||||
-- TODO: p2prc API
|
-- TODO: p2prc API
|
||||||
@@ -106,8 +108,11 @@ instance FromJSON P2prcConfig where
|
|||||||
|
|
||||||
{-# WARNING IPAdressTable "This newtype is highly unstable due to undergoing work on improving P2PRC's server api. For more information, visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114" #-}
|
{-# WARNING IPAdressTable "This newtype is highly unstable due to undergoing work on improving P2PRC's server api. For more information, visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114" #-}
|
||||||
|
|
||||||
|
|
||||||
|
-- | IP Table
|
||||||
newtype IPAdressTable
|
newtype IPAdressTable
|
||||||
= MkIPAdressTable [ServerInfo]
|
= MkIPAdressTable -- ^ Constructor
|
||||||
|
[ServerInfo] -- ^ List Servers
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
|
|
||||||
@@ -117,18 +122,20 @@ instance FromJSON IPAdressTable where
|
|||||||
MkIPAdressTable <$> v .: "ip_address"
|
MkIPAdressTable <$> v .: "ip_address"
|
||||||
|
|
||||||
|
|
||||||
data ServerInfo = MkServerInfo
|
{-# WARNING ServerInfo "This type is highly unstable due to undergoing work on improving P2PRC's server api. For more information, visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114" #-}
|
||||||
{ name :: T.Text
|
data ServerInfo =
|
||||||
, ip :: IPAddress
|
MkServerInfo
|
||||||
, latency :: Int
|
{ name :: T.Text
|
||||||
, download :: Int
|
, ip :: IPAddress
|
||||||
, upload :: Int
|
, latency :: Int
|
||||||
, serverPort :: Int
|
, download :: Int
|
||||||
, bareMetalSSHPort :: Maybe Int
|
, upload :: Int
|
||||||
, nat :: Bool
|
, serverPort :: Int
|
||||||
, escapeImplementation :: Maybe T.Text
|
, bareMetalSSHPort :: Maybe Int
|
||||||
, customInformation :: Maybe T.Text
|
, nat :: Bool
|
||||||
}
|
, escapeImplementation :: Maybe T.Text
|
||||||
|
, customInformation :: Maybe T.Text
|
||||||
|
}
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,12 +48,14 @@ module P2PRC
|
|||||||
|
|
||||||
-- ** Interface data types
|
-- ** Interface data types
|
||||||
-- | This section gives an overview on the runtime and host machine interfaces.
|
-- | This section gives an overview on the runtime and host machine interfaces.
|
||||||
, P2PRCapi
|
, P2PRCapi(..)
|
||||||
, P2prcConfig
|
, P2prcConfig(..)
|
||||||
|
|
||||||
-- ** Primitive data types
|
-- ** Primitive data types
|
||||||
-- | These types represent the core data that is communicated between requests and the runtime.
|
-- | These types represent the core data that is communicated between requests and the runtime.
|
||||||
, IPAdressTable
|
, IPAdressTable(..)
|
||||||
|
, ServerInfo(..)
|
||||||
|
, IPAddress(..)
|
||||||
, MapPortRequest(..)
|
, MapPortRequest(..)
|
||||||
, MapPortResponse(..)
|
, MapPortResponse(..)
|
||||||
, Error(..)
|
, Error(..)
|
||||||
@@ -70,14 +72,16 @@ import Engine
|
|||||||
)
|
)
|
||||||
|
|
||||||
import JSON
|
import JSON
|
||||||
( IPAdressTable
|
( IPAdressTable(..)
|
||||||
|
, ServerInfo(..)
|
||||||
|
, IPAddress(..)
|
||||||
, MapPortResponse(..)
|
, MapPortResponse(..)
|
||||||
, P2prcConfig
|
, P2prcConfig(..)
|
||||||
)
|
)
|
||||||
|
|
||||||
import API
|
import API
|
||||||
( MapPortRequest(MkMapPortRequest)
|
( MapPortRequest(..)
|
||||||
, P2PRCapi
|
, P2PRCapi(..)
|
||||||
, getP2prcAPI
|
, getP2prcAPI
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user