Commit 5a441bc2 authored by Haye Böhm's avatar Haye Böhm

Rewrite SDS definitions to use classes

parent 03a3350a
......@@ -192,7 +192,7 @@ viewCurDateTime = viewSharedInformation "The current date and time is:" [] curre
viewTime :: Task Time
viewTime = viewSharedInformation "The current time is:" [ViewAs AnalogClock] currentTime
personStore :: Shared [MyPerson]
personStore :: SDSLens () [MyPerson] [MyPerson]
personStore = sharedStore "Persons" []
editStoredPersons :: Task [MyPerson]
......@@ -276,7 +276,7 @@ person1by1 persons
editPersonList :: Task ()
editPersonList = editSharedList personStore
editSharedList :: (Shared [a]) -> Task () | iTask a
editSharedList :: (sds () [a] [a]) -> Task () | iTask a & RWShared sds
editSharedList store
= enterChoiceWithShared "Choose an item to edit" [ChooseFromGrid snd] (mapRead (\ps -> [(i,p) \\ p <- ps & i <- [0..]]) store)
>>* [ OnAction (Action "Append") (hasValue (showAndDo append))
......@@ -312,7 +312,7 @@ where
}
derive class iTask ToDo
toDoList :: Shared [ToDo]
toDoList :: SDSLens () [ToDo] [ToDo]
toDoList = sharedStore "My To Do List" []
editToDoList = editSharedList toDoList
......@@ -321,7 +321,7 @@ editToDoList = editSharedList toDoList
:: Tweet :== (String,String)
twitterId :: String -> Shared [Tweet]
twitterId :: String -> SDSLens () [Tweet] [Tweet]
twitterId name = sharedStore ("Twitter with " +++ name) []
followTweets
......@@ -329,7 +329,7 @@ followTweets
>>= \me -> enterChoiceWithShared "Whoms tweets you want to see?" [] users
>>= \user -> let name = getUserName user in joinTweets me user "type in your tweet" (twitterId name)
where
joinTweets :: User User String (Shared [Tweet]) -> Task ()
joinTweets :: User User String (sds () [Tweet] [Tweet]) -> Task () | RWShared sds
joinTweets me you message tweetsStore
= (viewSharedInformation ("You are following " +++ tweeter) [] tweetsStore)
||-
......@@ -484,7 +484,7 @@ editWithStatistics
>>* [ OnAction (ActionQuit) (always (return ()))
]
editFile :: String (Shared String) (SharedTaskList ()) -> Task ()
editFile :: String (sds () String String) (SharedTaskList ()) -> Task () | RWShared sds
editFile fileName sharedFile _
= updateSharedInformation ("edit " +++ fileName) [UpdateUsing id (const id) textArea] sharedFile
@! ()
......@@ -662,7 +662,7 @@ where
tictactoe_for_1 :: !Bool !(Shared TicTacToe) -> Task User
tictactoe_for_1 :: !Bool !(sds () TicTacToe TicTacToe) -> Task User | RWShared sds
tictactoe_for_1 my_turn sharedGameSt
= (viewSharedInformation "Board:" [ViewAs (\gameSt -> viewBoard (42,42) gameSt)] sharedGameSt) ||- play
where
......@@ -719,8 +719,3 @@ callProcessExample =
enterInformation "Enter the path to the external process. To for instance open a shell run '/bin/bash' or 'c:\\Windows\\System32\\cmd.exe'." []
>>= \path->'P'.callProcess () [] path [] Nothing Nothing
>>- viewInformation "Process terminated" []
//* Customizing interaction with views
//* Layout tuning
......@@ -55,5 +55,6 @@ import
//JSON(En|De)code for Dynamic and (->)
from iTasks.Internal.Serialization import generic JSONEncode, generic JSONDecode
import iTasks.Internal.SDS
from StdFunc import id, const, o
from Data.List import instance Functor []
......@@ -6,13 +6,15 @@ from iTasks.Internal.Tonic.Types import :: AllBlueprints, :: TonicModule, :: Ton
from Graphics.Scalable.Image import :: TagSource, :: TagRef, :: Image, :: ImageTag
from Graphics.Scalable.Internal.Image` import :: Image`
import iTasks.SDS.Definition
tonicDashboard :: [TaskAppRenderer] -> Task ()
tonic :: Task ()
tonicStaticBrowser :: [TaskAppRenderer] -> Task ()
tonicBrowseWithModule :: AllBlueprints [TaskAppRenderer] (Shared NavStack) TonicModule -> Task ()
tonicBrowseWithModule :: AllBlueprints [TaskAppRenderer] (sds () NavStack NavStack) TonicModule -> Task () | RWShared sds
tonicStaticWorkflow :: [TaskAppRenderer] -> Workflow
......@@ -20,4 +22,4 @@ tonicDynamicBrowser :: [TaskAppRenderer] -> Task ()
tonicDynamicWorkflow :: [TaskAppRenderer] -> Workflow
viewStaticTask :: !AllBlueprints ![TaskAppRenderer] !(Shared NavStack) !BlueprintIdent !TonicModule !TonicFunc !Int !Bool -> Task ()
viewStaticTask :: !AllBlueprints ![TaskAppRenderer] !(sds () NavStack NavStack) !BlueprintIdent !TonicModule !TonicFunc !Int !Bool -> Task () | RWShared sds
......@@ -67,7 +67,7 @@ tonicStaticBrowser rs
selectModule = getTonicModules >>- enterChoice "Select a module" [ChooseFromDropdown id]
noModuleSelection = viewInformation () [] "Select module..."
tonicBrowseWithModule :: AllBlueprints [TaskAppRenderer] (Shared NavStack) TonicModule -> Task ()
tonicBrowseWithModule :: AllBlueprints [TaskAppRenderer] (sds () NavStack NavStack) TonicModule -> Task () | RWShared sds
tonicBrowseWithModule allbps rs navstack tm
= (selectTask tm
>&> withSelection noTaskSelection (
......@@ -89,7 +89,7 @@ tonicBrowseWithModule allbps rs navstack tm
noTaskSelection = viewInformation () [] "Select task..."
viewStaticTask :: !AllBlueprints ![TaskAppRenderer] !(Shared NavStack) !BlueprintIdent !TonicModule !TonicFunc !Int !Bool -> Task ()
viewStaticTask :: !AllBlueprints ![TaskAppRenderer] !(sds () NavStack NavStack) !BlueprintIdent !TonicModule !TonicFunc !Int !Bool -> Task () | RWShared sds
viewStaticTask allbps rs navstack bpref tm tt depth compact
= get navstack
>>~ \ns -> (showStaticBlueprint rs bpref (expandTask allbps depth tt) compact depth
......@@ -282,14 +282,14 @@ tonicDynamicBrowser rs
//# (as,bs) = split xs
//= merge f (mergeSortBy f as) (mergeSortBy f bs)
tonicDynamicBrowser` :: [TaskAppRenderer] (Shared NavStack) -> Task ()
tonicDynamicBrowser` :: [TaskAppRenderer] (sds () NavStack NavStack) -> Task () | RWShared sds
tonicDynamicBrowser` rs navstack =
((activeBlueprintInstances -&&- blueprintViewer) /* <<@ ArrangeVertical */) @! ()
where
activeBlueprintInstances = editSharedChoiceWithSharedAs
(Title "Active blueprint instances")
[ChooseFromGrid customView]
(mapRead (\(trt, q) -> filterActiveTasks q (flattenRTMap trt)) (tonicSharedRT |+| queryShare))
(mapRead (\(trt, q) -> filterActiveTasks q (flattenRTMap trt)) (tonicSharedRT |*| queryShare))
setTaskId selectedBlueprint <<@ ArrangeWithSideBar 0 TopSide 175 True
where
setTaskId x = { click_origin_mbbpident = Nothing
......@@ -309,13 +309,13 @@ tonicDynamicBrowser` rs navstack =
g tid ((mn, fn), bpi) acc = 'DM'.put (tid, mn, fn) bpi acc
blueprintViewer
= whileUnchanged (selectedBlueprint |+| navstack) (
= whileUnchanged (selectedBlueprint |*| navstack) (
\(bpmeta, ns) -> case bpmeta of
Just meta=:{click_target_bpident = {bpident_compId = Just tid, bpident_moduleName, bpident_compName}}
# focus = (sdsFocus (comp2TaskId tid, bpident_moduleName, bpident_compName) tonicInstances)
= get focus
>>~ \mbprnt -> get selectedDetail
>>~ \selDetail -> whileUnchanged (focus |+| dynamicDisplaySettings) (
>>~ \selDetail -> whileUnchanged (focus |*| dynamicDisplaySettings) (
\shareData ->
case shareData of
(Just bpinst, dynSett) -> viewInstance rs navstack dynSett bpinst selDetail meta
......@@ -397,9 +397,9 @@ getModuleAndTask allbps mn tn
Just tt -> return (mod, tt)
_ -> throw "Can't get module and task"
viewInstance :: ![TaskAppRenderer] !(Shared NavStack) !DynamicDisplaySettings !BlueprintInstance
viewInstance :: ![TaskAppRenderer] !(sds () NavStack NavStack) !DynamicDisplaySettings !BlueprintInstance
!(Maybe (Either ClickMeta (ModuleName, FuncName, ComputationId, Int))) !ClickMeta
-> Task ()
-> Task () | RWShared sds
viewInstance rs navstack dynSett bpinst=:{bpi_bpref = {bpr_moduleName, bpr_taskName}} selDetail meta=:{click_target_bpident = {bpident_compId = Just tid}}
= (if (dynSett.DynamicDisplaySettings.show_comments && bpinst.bpi_blueprint.tf_comments <> "")
(viewInformation "Task comments" [] bpinst.bpi_blueprint.tf_comments @! ())
......
......@@ -16,12 +16,12 @@ derive class iTask UserAccount
// Shares
//* All user accounts
userAccounts :: Shared [UserAccount]
userAccounts :: SDSLens () [UserAccount] [UserAccount]
//* All users
users :: ReadOnlyShared [User]
users :: SDSLens () [User] ()
//* Users with a specific role
usersWithRole :: !Role -> ReadOnlyShared [User]
usersWithRole :: !Role -> SDSLens () [User] ()
/**
* Authenticates a user by username and password
......
......@@ -10,21 +10,21 @@ derive class iTask UserAccount
//Initial root user
ROOT_USER :== {credentials={Credentials|username=Username "root",password = Password "root"},title = Just "Root user", roles = ["admin","manager"]}
userAccounts :: Shared [UserAccount]
userAccounts :: SDSLens () [UserAccount] [UserAccount]
userAccounts = sharedStore "UserAccounts" [ROOT_USER]
users :: ReadOnlyShared [User]
users :: SDSLens () [User] ()
users = mapReadWrite (\accounts -> [AuthenticatedUser (toString a.UserAccount.credentials.Credentials.username) a.UserAccount.roles a.UserAccount.title
\\ a <- accounts]
, \() accounts -> Nothing) userAccounts
usersWithRole :: !Role -> ReadOnlyShared [User]
usersWithRole :: !Role -> SDSLens () [User] ()
usersWithRole role = mapRead (filter (hasRole role)) users
where
hasRole role (AuthenticatedUser _ roles _) = isMember role roles
hasRole _ _ = False
userAccount :: UserId -> Shared (Maybe UserAccount)
userAccount :: UserId -> SDSLens () (Maybe UserAccount) (Maybe UserAccount)
userAccount userId = mapReadWrite (getAccount userId, \w r -> Just (setAccount w r)) userAccounts
where
getAccount :: UserId [UserAccount] -> Maybe UserAccount
......
......@@ -40,10 +40,8 @@ derive gEq WorkflowTaskContainer
// Available workflows
:: WorkflowFolderLabel :== String
workflows :: Shared [Workflow]
allowedWorkflows :: ReadOnlyShared [Workflow]
workflowByPath :: !String -> Shared Workflow
workflows :: SDSLens () [Workflow] [Workflow]
workflowByPath :: !String -> SDSLens () Workflow Workflow
/**
* Wraps any task as a workflow with no access restrictions
*
......
......@@ -37,13 +37,13 @@ gDefault{|WorkflowTaskContainer|} = WorkflowTask (return ())
derive class iTask WorklistRow
// list of active task instances for current user without current one (to avoid work on dependency cycles)
myWork :: ReadOnlyShared [(TaskId,WorklistRow)]
myWork :: SDSLens () [(TaskId,WorklistRow)] ()
myWork = workList taskInstancesForCurrentUser
allWork :: ReadOnlyShared [(TaskId,WorklistRow)]
allWork :: SDSLens () [(TaskId,WorklistRow)] ()
allWork = workList allTaskInstances
workList instances = mapRead projection (instances |+| currentTopTask)
workList instances = mapRead projection (instances |*| currentTopTask)
where
projection (instances,ownPid)
= [(TaskId i.TaskInstance.instanceNo 0, mkRow i) \\ i <- instances | notSelf ownPid i && isActive i]
......@@ -69,10 +69,10 @@ where
// SHARES
// Available workflows
workflows :: Shared [Workflow]
workflows :: SDSLens () [Workflow] [Workflow]
workflows = sharedStore "Workflows" []
workflowByPath :: !String -> Shared Workflow
workflowByPath :: !String -> SDSLens () Workflow Workflow
workflowByPath path = mapReadWriteError (toPrj,fromPrj) workflows
where
toPrj wfs = case [wf \\ wf <- wfs | wf.Workflow.path == path] of
......@@ -82,16 +82,16 @@ where
fromPrj nwf wfs
= Ok (Just [if (wf.path == path) nwf wf \\ wf <- wfs])
allowedWorkflows :: ReadOnlyShared [Workflow]
allowedWorkflows = mapRead filterAllowed (workflows |+| currentUser)
allowedWorkflows :: SDSLens () [Workflow] ()
allowedWorkflows = mapRead filterAllowed (workflows |*| currentUser)
where
filterAllowed (workflows,user) = filter (isAllowedWorkflow user) workflows
//All tasks that you can do in a session
allowedTransientTasks :: ReadOnlyShared [Workflow]
allowedTransientTasks :: SDSLens () [Workflow] ()
allowedTransientTasks = mapRead (\wfs -> [wf \\ wf=:{Workflow|transient} <- wfs | transient]) allowedWorkflows
allowedPersistentWorkflows :: ReadOnlyShared [Workflow]
allowedPersistentWorkflows :: SDSLens () [Workflow] ()
allowedPersistentWorkflows = mapRead (\wfs -> [wf \\ wf=:{Workflow|transient} <- wfs | not transient]) allowedWorkflows
// MANAGEMENT TASKS
......@@ -249,7 +249,7 @@ where
result (Value [x] s) = Value x s
result _ = NoValue
viewWorkflowDetails :: !(ReadOnlyShared (Maybe Workflow)) -> Task Workflow
viewWorkflowDetails :: !(sds () (Maybe Workflow) ()) -> Task Workflow | RWShared sds
viewWorkflowDetails sel
= viewSharedInformation [Att (Title "Task description"), Att IconView] [ViewUsing view textView] sel
@? onlyJust
......@@ -312,7 +312,7 @@ where
//Look in the catalog for an entry that has the same path as
//the 'catalogId' that is stored in the incompatible task instance's properties
findReplacement taskId
= get (sdsFocus taskId (taskListEntryMeta topLevelTasks) |+| workflows)
= get (sdsFocus taskId (taskListEntryMeta topLevelTasks) |*| workflows)
@ \(taskListEntry,catalog) -> maybe Nothing (lookup catalog) ('DM'.get "catalogId" taskListEntry.TaskListItem.attributes)
where
lookup [wf=:{Workflow|path}:wfs] cid = if (path == cid) (Just wf) (lookup wfs cid)
......
......@@ -15,6 +15,8 @@ import iTasks.UI.Editor
import iTasks.UI.Editor.Controls
import iTasks.UI.Editor.Modifiers
import iTasks.Internal.SDS
import StdBool, StdArray, StdEnum, StdList, StdString
import Text, Text.GenJSON, System.Time
......
......@@ -63,16 +63,16 @@ derive gEditor User, UserConstraint, Username, Password
derive class iTask Credentials
//* Authentication of the current instance
currentUser :: RWShared () User User
currentUser :: SDSLens () User User
//* Authentication of a task instance instance
taskInstanceUser :: RWShared InstanceNo User User
taskInstanceUser :: SDSLens InstanceNo User User
//* Selected task instances
processesForUser :: User -> ReadOnlyShared [TaskListItem ()]
processesForCurrentUser :: ReadOnlyShared [TaskListItem ()]
processesForUser :: User -> SDSLens () [TaskListItem ()] ()
processesForCurrentUser :: SDSLens () [TaskListItem ()] ()
taskInstancesForUser :: ROShared User [TaskInstance]
taskInstancesForCurrentUser :: ROShared () [TaskInstance]
taskInstancesForUser :: SDSLens User [TaskInstance] ()
taskInstancesForCurrentUser :: SDSSequence () [TaskInstance] ()
/*
* Copies authentication attributes of current task
......
......@@ -123,12 +123,12 @@ where
derive class iTask Credentials
currentUser :: RWShared () User User
currentUser :: SDSLens () User User
currentUser = sdsLens "currentUser" id (SDSRead userFromAttr) (SDSWrite userToAttr) (SDSNotify notify) currentTaskInstanceAttributes
where
notify _ _ _ = const (const True)
taskInstanceUser :: RWShared InstanceNo User User
taskInstanceUser :: SDSLens InstanceNo User User
taskInstanceUser = sdsLens "taskInstanceUser" id (SDSRead userFromAttr) (SDSWrite userToAttr) (SDSNotify notify) taskInstanceAttributesByNo
where
notify _ _ _ = const (const True)
......@@ -154,11 +154,11 @@ userToAttr _ attr _
# attr = 'DM'.del "auth-title" attr
= Ok (Just attr)
processesForUser :: User -> ReadOnlyShared [TaskListItem ()]
processesForUser :: User -> SDSLens () [TaskListItem ()] ()
processesForUser user = mapRead (filter (forWorker user)) currentProcesses
processesForCurrentUser :: ReadOnlyShared [TaskListItem ()]
processesForCurrentUser = mapRead readPrj (currentProcesses >+| currentUser)
processesForCurrentUser :: SDSLens () [TaskListItem ()] ()
processesForCurrentUser = mapRead readPrj (currentProcesses >*| currentUser)
where
readPrj (items,user) = filter (forWorker user) items
......@@ -172,7 +172,7 @@ forWorker user {TaskListItem|attributes} = case 'DM'.get "user" attributes of
_ = False
Nothing = True
taskInstancesForUser :: ROShared User [TaskInstance]
taskInstancesForUser :: SDSLens User [TaskInstance] ()
taskInstancesForUser = sdsLens "taskInstancesForUser" (const ()) (SDSRead read) (SDSWriteConst write) (SDSNotify notify) detachedTaskInstances
where
read u instances = Ok (filter (forUser u) instances)
......@@ -190,7 +190,7 @@ where
_ = False
Nothing = True
taskInstancesForCurrentUser :: ROShared () [TaskInstance]
taskInstancesForCurrentUser :: SDSSequence () [TaskInstance] ()
taskInstancesForCurrentUser
= sdsSequence "taskInstancesForCurrentUser"
id
......
......@@ -60,7 +60,7 @@ serveWebService port handler
@! ()
where
manageConnections io
= tcplisten port False (currentTimespec |+< io)
= tcplisten port False (currentTimestamp |*< io)
{ConnectionHandlers|onConnect=onConnect,onData=onData,onShareChange=onShareChange,onDisconnect=onDisconnect}
onConnect client_name (now,io)
......
......@@ -147,7 +147,6 @@ createClientIWorld serverURL currentInstance
,memoryShares = 'Data.Map'.newMap
,readCache = 'Data.Map'.newMap
,writeCache = 'Data.Map'.newMap
,exposedShares = 'Data.Map'.newMap
,jsCompilerState = locundef "jsCompilerState"
,shutdown = Nothing
,random = genRandInt seed
......
......@@ -17,8 +17,8 @@ from iTasks.Internal.TaskEval import :: TaskTime
from iTasks.WF.Definition import :: TaskValue, :: Event, :: TaskId, :: InstanceNo, :: TaskNo
from iTasks.WF.Combinators.Core import :: ParallelTaskType, :: TaskListItem
from iTasks.SDS.Definition import :: SDS, :: RWShared, :: ReadWriteShared, :: Shared, :: ReadOnlyShared
from iTasks.Internal.SDS import :: SDSNotifyRequest, :: JSONShared, :: DeferredWrite
import iTasks.SDS.Definition
from iTasks.Internal.SDS import :: SDSNotifyRequest, :: DeferredWrite
from iTasks.Extensions.DateTime import :: Time, :: Date, :: DateTime
from Sapl.Linker.LazyLinker import :: LoaderState
......@@ -39,7 +39,6 @@ CLEAN_HOME_VAR :== "CLEAN_HOME"
, memoryShares :: !Map String Dynamic // Run-time memory shares
, readCache :: !Map (String,String) Dynamic // Cached share reads
, writeCache :: !Map (String,String) (Dynamic,DeferredWrite) // Cached deferred writes
, exposedShares :: !Map String (Dynamic, JSONShared) // Shared source
, jsCompilerState :: !Maybe JSCompilerState // Sapl to Javascript compiler state
, ioTasks :: !*IOTasks // The low-level input/output tasks
......@@ -95,7 +94,6 @@ CLEAN_HOME_VAR :== "CLEAN_HOME"
}
:: ConnectionId :== Int
:: IOStates :== Map TaskId IOState
:: IOState
= IOActive !(Map ConnectionId (!Dynamic,!Bool)) // Bool: stability
......@@ -137,8 +135,8 @@ destroyIWorld :: !*IWorld -> *World
, interval :: a
}
iworldTimespec :: SDS (ClockParameter Timespec) Timespec Timespec
iworldTimestamp :: SDS (ClockParameter Timestamp) Timestamp Timestamp
iworldTimespec :: SDSSource (ClockParameter Timespec) Timespec Timespec
iworldTimestamp :: SDSSource (ClockParameter Timestamp) Timestamp Timestamp
/*
* Calculate the next fire for the given timespec
......@@ -150,7 +148,7 @@ iworldTimestamp :: SDS (ClockParameter Timestamp) Timestamp Timestamp
*/
iworldTimespecNextFire :: Timespec Timespec (ClockParameter Timespec) -> Timespec
iworldLocalDateTime :: ReadOnlyShared DateTime
iworldLocalDateTime :: SDSParallel () DateTime ()
iworldLocalDateTime` :: !*IWorld -> (!DateTime, !*IWorld)
......
......@@ -40,6 +40,8 @@ from Sapl.Target.Flavour import :: Flavour, toFlavour
from Sapl.Target.CleanFlavour import cleanFlavour
from Sapl.SaplParser import :: ParserState
from iTasks.SDS.Definition import :: SDSParallel
//The following modules are excluded by the SAPL -> Javascript compiler
//because they contain functions implemented in ABC code that cannot
//be compiled to javascript anyway. Handwritten Javascript overrides need
......@@ -75,7 +77,6 @@ createIWorld options world
,memoryShares = 'DM'.newMap
,readCache = 'DM'.newMap
,writeCache = 'DM'.newMap
,exposedShares = 'DM'.newMap
,jsCompilerState = Nothing
,shutdown = Nothing
,ioTasks = {done = [], todo = []}
......@@ -115,7 +116,7 @@ determineAppPath world
destroyIWorld :: !*IWorld -> *World
destroyIWorld iworld=:{IWorld|world} = world
iworldTimespec :: SDS (ClockParameter Timespec) Timespec Timespec
iworldTimespec :: SDSSource (ClockParameter Timespec) Timespec Timespec
iworldTimespec = createReadWriteSDS "IWorld" "timespec" read write
where
read _ iworld=:{IWorld|clock} = (Ok clock,iworld)
......@@ -141,11 +142,11 @@ iworldTimestamp :: SDS (ClockParameter Timestamp) Timestamp Timestamp
iworldTimestamp = mapReadWrite (timespecToStamp, const o Just o timestampToSpec)
$ sdsTranslate "iworldTimestamp translation" (\{start,interval}->{start=timestampToSpec start,interval=timestampToSpec interval}) iworldTimespec
iworldLocalDateTime :: ReadOnlyShared DateTime
iworldLocalDateTime :: SDSParallel () DateTime ()
iworldLocalDateTime = SDSParallel (createReadOnlySDS \_ -> iworldLocalDateTime`) (sdsFocus {start=Timestamp 0,interval=Timestamp 1} iworldTimestamp) sdsPar
where
// ignore value, but use notifications for 'iworldTimestamp'
sdsPar = { SDSParallel
sdsPar = { SDSParallelOptions
| name = "iworldLocalDateTime"
, param = \p -> (p,p)
, read = fst
......
......@@ -21,9 +21,38 @@ import iTasks.SDS.Definition
, cmpParam :: Dynamic //Parameter we are saving for comparison
, cmpParamText :: String //String version of comparison parameter for tracing
}
:: SDSIdentity :== String
:: DeferredWrite = E. p r w: DeferredWrite !p !w !(SDS p r w) & iTask p & TC r & TC w
:: DeferredWrite = E. p r w sds: DeferredWrite !p !w !(sds p r w) & iTask p & TC r & TC w & RWShared sds
instance Identifiable SDSSource
instance Readable SDSSource
instance Writable SDSSource
instance Registrable SDSSource
instance Identifiable SDSLens
instance Readable SDSLens
instance Writable SDSLens
instance Registrable SDSLens
instance Identifiable SDSCache
instance Readable SDSCache
instance Writable SDSCache
instance Registrable SDSCache
instance Identifiable SDSSequence
instance Readable SDSSequence
instance Writable SDSSequence
instance Registrable SDSSequence
instance Identifiable SDSSelect
instance Readable SDSSelect
instance Writable SDSSelect
instance Registrable SDSSelect
instance Identifiable SDSParallel
instance Readable SDSParallel
instance Writable SDSParallel
instance Registrable SDSParallel
//Internal creation functions:
......@@ -33,31 +62,31 @@ createReadWriteSDS ::
!(p *IWorld -> *(!MaybeError TaskException r, !*IWorld))
!(p w *IWorld -> *(!MaybeError TaskException (SDSNotifyPred p), !*IWorld))
->
RWShared p r w
SDSSource p r w
createReadOnlySDS ::
!(p *IWorld -> *(!r, !*IWorld))
->
ROShared p r
SDSSource p r ()
createReadOnlySDSError ::
!(p *IWorld -> *(!MaybeError TaskException r, !*IWorld))
->
ROShared p r
SDSSource p r ()
//Internal access functions
//Just read an SDS
read :: !(RWShared () r w) !*IWorld -> (!MaybeError TaskException r, !*IWorld) | TC r
read :: !(sds () r w) !*IWorld -> (!MaybeError TaskException r, !*IWorld) | TC r & Readable sds
//Read an SDS and register a taskId to be notified when it is written
readRegister :: !TaskId !(RWShared () r w) !*IWorld -> (!MaybeError TaskException r, !*IWorld) | TC r
readRegister :: !TaskId !(sds () r w) !*IWorld -> (!MaybeError TaskException r, !*IWorld) | TC r & Readable, Registrable sds
//Write an SDS (and queue evaluation of those task instances which contained tasks that registered for notification)
write :: !w !(RWShared () r w) !*IWorld -> (!MaybeError TaskException (), !*IWorld) | TC r & TC w
//Read followed by write. The 'a' typed value is a result that is returned
modify :: !(r -> (!a,!w)) !(RWShared () r w) !*IWorld -> (!MaybeError TaskException a, !*IWorld) | TC r & TC w
write :: !w !(sds () r w) !*IWorld -> (!MaybeError TaskException (), !*IWorld) | TC r & TC w & Writable sds
//Force notify (queue evaluation of task instances that registered for notification)
notify :: !(RWShared () r w) !*IWorld -> (!MaybeError TaskException (), !*IWorld)
//Read followed by write. The 'a' typed value is a result that is returned
modify :: !(r -> (!a,!w)) !(sds () r w) !*IWorld -> (!MaybeError TaskException a, !*IWorld) | TC r & TC w & Readable sds & Writable sds
//Clear all registrations for the given tasks.
//This is normally called by the queueRefresh functions, because once a task is queued
......@@ -71,11 +100,3 @@ formatSDSRegistrationsList :: [(InstanceNo,[(TaskId,SDSIdentity)])] -> String