Commit f0588156 authored by Steffen Michels's avatar Steffen Michels

introduce type synonyms for simple cases of all SDS types

parent 11d20d10
Pipeline #17927 passed with stage
in 4 minutes and 27 seconds
......@@ -106,7 +106,7 @@ viewLayout = updateMapStatus EditMode @! ()
sharedMapAction :: SimpleSDSLens (MapAction SectionStatus)
sharedMapAction = sharedStore "sharedMapAction" (FocusOnMap 0) // start at the top-level (all maps)
sharedEditShip :: SDSParallel () (Maps2D,MapAction SectionStatus) (Maps2D,MapAction SectionStatus)
sharedEditShip :: SimpleSDSParallel (Maps2D,MapAction SectionStatus)
sharedEditShip = maps2DShare >*< sharedMapAction
manageDevices :: Task ()
......
......@@ -91,7 +91,7 @@ sectionForUserShare user = mapRead (sectionForUser user) sectionUsersShare
focusedSectionUsersShare :: FocusedSectionUsersShare
focusedSectionUsersShare = mapLens "focusedSectionUsersShare" sectionUsersShare (Just [])
inventoryForUserSection :: !User !(FocusedSectionInventoryShare o) -> SDSSequence () (IntMap (Object o)) (IntMap (Object o)) | iTask o
inventoryForUserSection :: !User !(FocusedSectionInventoryShare o) -> SimpleSDSSequence (IntMap (Object o)) | iTask o
inventoryForUserSection user inventoryForSectionShare = sdsSequence ("inventoryForUserSection" +++ toString user) id mkP2 (\_ _ -> Right mkr) (SDSWrite write1) (SDSWrite write2) (sectionForUserShare user) inventoryForSectionShare
where
mkP2 p (Just c3d) = c3d
......
......@@ -24,6 +24,6 @@ startAuthEngine :: Domain -> Task ()
enterDomain :: Task Domain
currentDistributedUser :: SDSParallel () (User,Domain) (User,Domain)
currentDistributedUser :: SimpleSDSParallel (User,Domain)
currentDomain :: SDSLens () Domain ()
......@@ -187,7 +187,7 @@ startAuthEngine (Domain domain)
authServerInfoShare :: SimpleSDSLens String
authServerInfoShare = sharedStore "authServer" ""
currentDistributedUser :: SDSParallel () (User,Domain) (User,Domain)
currentDistributedUser :: SimpleSDSParallel (User,Domain)
currentDistributedUser = sdsParallel "communicationDetailsByNo" param read (SDSWriteConst writel) (SDSWriteConst writer) currentUser authServerInfoShare
where
param p = (p,p)
......
......@@ -156,6 +156,11 @@ instance toString (WebServiceShareOptions p r w)
//some registered parameter of type p needs to be notified.
:: SDSNotifyPred p :== Timespec p -> Bool
/**
* A SDSSource with no parameter and equal read and write type.
*/
:: SimpleSDSSource a :== SDSSource () a a
//Sources provide direct access to a data source
:: SDSSource p r w = SDSSource !(SDSSourceOptions p r w)
......@@ -214,6 +219,11 @@ required type w. The reducer has the job to turn this ws into w.
= SDSNotify !(pw rs w -> SDSNotifyPred pq)
| SDSNotifyConst !(pw w -> SDSNotifyPred pq)
/**
* A SDSSelect with no parameter and equal read and write type.
*/
:: SimpleSDSSelect a :== SDSSelect () a a
//Merge two sources by selecting one based on the parameter
:: SDSSelect p r w = E. p1 p2 sds1 sds2: SDSSelect !(sds1 p1 r w) !(sds2 p2 r w) !(SDSSelectOptions p r w p1 p2)
& RWShared sds1 & RWShared sds2 & gText{|*|} p1 & TC p1 & gText{|*|} p2 & TC p2 & TC r & TC w
......@@ -225,6 +235,11 @@ required type w. The reducer has the job to turn this ws into w.
, notifyr :: !SDSLensNotify p2 p1 w r
}
/**
* A SDSParallel with no parameter and equal read and write type.
*/
:: SimpleSDSParallel a :== SDSParallel () a a
//Read from and write to two independent SDS's
:: SDSParallel p r w
= E. p1 r1 w1 p2 r2 w2 sds1 sds2:
......@@ -248,6 +263,11 @@ required type w. The reducer has the job to turn this ws into w.
, writer :: !SDSLensWrite p w r2 w2
}
/**
* A SDSSequence with no parameter and equal read and write type.
*/
:: SimpleSDSSequence a :== SDSSequence () a a
//Read from and write to two dependent SDS's
//The read value from the first is used to compute the parameter for the second
:: SDSSequence p r w =
......@@ -266,6 +286,11 @@ required type w. The reducer has the job to turn this ws into w.
, writer :: !SDSLensWrite p w r2 w2
}
/**
* A SDSCache with no parameter and equal read and write type.
*/
:: SimpleSDSCache a :== SDSCache () a a
// TODO: For some reason, gText{|*|} p & TC p is not sufficient and causes overloading errors in the implementation of Readable and Writeable for SDSCache. iTask p seems to solve this for unknown reasons.
:: SDSCache p r w = E. sds: SDSCache !(SDSSource p r w) !(SDSCacheOptions p r w) & iTask p & TC r & TC w
:: SDSCacheOptions p r w =
......@@ -274,6 +299,11 @@ required type w. The reducer has the job to turn this ws into w.
:: SDSCacheWrite = WriteNow | WriteDelayed | NoWrite
/**
* A SDSRemoteSource with no parameter and equal read and write type.
*/
:: SimpleSDSRemoteSource a :== SDSRemoteSource () a a
/**
* A SDSRemoteSource is a share tree living on another system. Evaluating it will cause an
* asynchronous message to be sent to the other server to retrieve the value for the
......@@ -299,6 +329,12 @@ required type w. The reducer has the job to turn this ws into w.
, fromTextResponse :: !String p Bool -> MaybeErrorString (!Maybe r, !Maybe String)
, writeMessageHandlers :: !Maybe (!p w -> String, !p String -> MaybeErrorString (Maybe (SDSNotifyPred p)))
}
/**
* A SDSRemoteService with no parameter and equal read and write type.
*/
:: SimpleSDSRemoteService a :== SDSRemoteService () a a
/**
* A SDSRemoteServive is a share which allows you to connect to the outside world.
* For now it just allows you to send HTTP messages and receive responses asynchronously.
......
......@@ -15,7 +15,7 @@ constShare :: !a -> SDSSource p a ()
nullShare :: SDSSource p () a
// Useful placeholder when you need a share don't intent to use it
unitShare :: SDSSource () () ()
unitShare :: SimpleSDSSource ()
// Random source
randomInt :: SDSSource () Int ()
......
......@@ -18,7 +18,7 @@ constShare v = createReadOnlySDS (\_ env -> (v, env))
nullShare :: SDSSource p () a
nullShare = createReadWriteSDS "_core_" "nullShare" (\_ env -> (Ok (), env)) (\_ _ env -> (Ok (const (const False)), env))
unitShare :: SDSSource () () ()
unitShare :: SimpleSDSSource ()
unitShare = nullShare
worldShare :: (p *World -> *(MaybeErrorString r,*World)) (p w *World -> *(MaybeErrorString (),*World)) -> SDSSource p r w
......
......@@ -53,7 +53,7 @@ currentTopTask :: SDSLens () TaskId ()
//Task instances
currentTaskInstanceNo :: SDSSource () InstanceNo ()
currentTaskInstanceAttributes :: SDSSequence () TaskAttributes TaskAttributes
currentTaskInstanceAttributes :: SimpleSDSSequence TaskAttributes
allTaskInstances :: SDSLens () [TaskInstance] ()
detachedTaskInstances :: SDSLens () [TaskInstance] () //Exclude sessions
taskInstanceByNo :: SDSLens InstanceNo TaskInstance TaskAttributes
......
......@@ -72,7 +72,7 @@ taskInstanceFromInstanceData (instanceNo,Just {InstanceConstants|session,listId,
currentTaskInstanceNo :: SDSSource () InstanceNo ()
currentTaskInstanceNo = createReadOnlySDS (\() iworld=:{current={taskInstance}} -> (taskInstance,iworld))
currentTaskInstanceAttributes :: SDSSequence () TaskAttributes TaskAttributes
currentTaskInstanceAttributes :: SimpleSDSSequence TaskAttributes
currentTaskInstanceAttributes
= sdsSequence "currentTaskInstanceAttributes"
id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment