TaskServer.dcl 1.25 KB
Newer Older
1
definition module iTasks._Framework.TaskServer
2 3 4 5 6

from Data.Maybe 		import :: Maybe
from StdFile			import class FileSystem
from TCPIP				import class ChannelEnv, :: IPAddress, :: Timeout
from Internet.HTTP		import :: HTTPRequest, :: HTTPResponse
7

8
from System.Time				import :: Timestamp
9 10
from Data.Error                 import :: MaybeError
from iTasks.API.Core.Types      import :: TaskId
11
from iTasks._Framework.IWorld	import :: IWorld, :: BackgroundTaskId
12 13
from iTasks._Framework.Task     import :: ConnectionTask, :: BackgroundTask, :: TaskException
from iTasks._Framework.Engine   import :: ConnectionType
14

15
//Core task server loop
16
serve :: !Int !ConnectionTask ![BackgroundTask] (*IWorld -> (!Maybe Timeout,!*IWorld)) *IWorld -> *IWorld
17 18 19 20 21 22

//Dynamically add a listener
addListener :: !TaskId !Int !Bool !ConnectionTask !*IWorld -> (!MaybeError TaskException (),!*IWorld)

//Dynamically add a connection
addConnection :: !TaskId !String !Int !ConnectionTask !*IWorld -> (!MaybeError TaskException (),!*IWorld)
23 24 25 26 27 28

//Dynamically add a background task
addBackgroundTask :: !BackgroundTaskId !BackgroundTask !*IWorld -> (!MaybeError TaskException (),!*IWorld)

//Dynamically remove a background task
removeBackgroundTask :: !BackgroundTaskId !*IWorld -> (!MaybeError TaskException (),!*IWorld)