Portability | portable |
---|---|
Stability | experimental |
Maintainer | mik@konecny.aow.cz |
Definitions of a few universaly useful simple network processes and process templates.
- constantProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (q -> a) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- constantChangedProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (q -> a) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- constantStatefulProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (s -> (QueryId, q) -> ((Bool, a), Maybe s)) -> s -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- passThroughProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> (q1 -> q2) -> (q1 -> a2 -> a1) -> ChannelType -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- maybePassThroughProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> (q1 -> Bool) -> (q1 -> a1) -> (q1 -> q2) -> (q1 -> a2 -> a1) -> ChannelType -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- passThroughStatefulProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (s -> (QueryId, q1) -> (ERProcessAction s q2 a1, Maybe s)) -> (s -> (QueryId, q1) -> (q2, a2) -> (ERProcessAction s q2 a1, Maybe s)) -> s -> ChannelType -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- passThroughBinaryStatefulProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (s -> (QueryId, q) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)) -> (s -> (QueryId, q) -> (Maybe a1, Maybe a2) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)) -> s -> (ChannelType, ChannelType) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- passThroughBinaryProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> (q -> (q1, q2)) -> (q -> (a1, a2) -> a) -> (ChannelType, ChannelType) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- rateProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (a -> a -> Bool) -> Int -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
- precProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> ChannelType -> a -> ERProcess sInAnyProt sOutAnyProt
Documentation
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> ERProcessName | process identifier (string) |
-> (q -> a) | function to answer queries |
-> ChannelType | result channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A generic stateless process with no inputs.
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> ERProcessName | process identifier (string) |
-> (q -> a) | function to answer queries (without the ChTChanges wrapper) |
-> ChannelType | result channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A generic process with no inputs that answers using a ChTChanges protocol.
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> ERProcessName | process identifier (string) |
-> (s -> (QueryId, q) -> ((Bool, a), Maybe s)) | function to answer queries and transform state |
-> s | initial state |
-> ChannelType | result channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A generic stateful process with no inputs.
:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> Bool | should use channel cache? |
-> ERProcessName | |
-> (q1 -> q2) | query translator |
-> (q1 -> a2 -> a1) | answer translator |
-> ChannelType | argument channel type |
-> ChannelType | result channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A simple process that passes on a translated version of each query to another process and translates the answers before passing them back.
:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> Bool | should use channel cache? |
-> ERProcessName | |
-> (q1 -> Bool) | if True, query should NOT be passed on |
-> (q1 -> a1) | responder to use if not passing queries on |
-> (q1 -> q2) | translator for queries to pass on |
-> (q1 -> a2 -> a1) | translator for passed answers |
-> ChannelType | input channel type |
-> ChannelType | output channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A simple process that either responds with no further queries or passes on a translated version of the query to another process, and then passing back a translated version of the answer received.
passThroughStatefulProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> ERProcessName | |
-> (s -> (QueryId, q1) -> (ERProcessAction s q2 a1, Maybe s)) | what to do with a query + forward or reply |
-> (s -> (QueryId, q1) -> (q2, a2) -> (ERProcessAction s q2 a1, Maybe s)) | what to do with an answer - another query or reply |
-> s | initial state |
-> ChannelType | argument channel type |
-> ChannelType | result channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A process with one input and one output socket. Upon receiving a query or an answer related to a previously received query, the process uses the provided functions to decide whether to answer the query, make a new query or wait until the state meets a certain condition. When the condition is met, the event (query or answer) in question is processed again using the same function.
Several simpler processes are defined as specialisations of this one.
passThroughBinaryStatefulProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> ERProcessName | |
-> (s -> (QueryId, q) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)) | what to do with a query + forward or reply |
-> (s -> (QueryId, q) -> (Maybe a1, Maybe a2) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)) | what to do with an answer - another query or reply |
-> s | initial state |
-> (ChannelType, ChannelType) | argument channels types |
-> ChannelType | result channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A process that passes on a translated version of each query to one or both of another 2 channels. When the other channel(s) answer, it analyses the answer(s) and decides whether to send other queries or answer its original query.
passThroughBinaryProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> Bool | should use channel cache? |
-> ERProcessName | |
-> (q -> (q1, q2)) | query translator |
-> (q -> (a1, a2) -> a) | answer translator |
-> (ChannelType, ChannelType) | argument channels types |
-> ChannelType | result channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A simple process that passes on a translated version of each query to another process and translates the answers before passing them back.
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> ERProcessName | process identifier (string) |
-> (a -> a -> Bool) | function to judge whether the improvement is good enough |
-> Int | maximum number of attempts to reach desired improvement |
-> ChannelType | number channel type |
-> ERProcess sInAnyProt sOutAnyProt |
A process passing on information without modification, except for improving the convergence rate in successive queries.
Each query may refer to a previous query. When it does, the query will not be answered until either:
- the answer has improved sufficiently since last time one was given
- the number of queries made in response to this query has reached the given limit
Currently supports only single-threaded querying.
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) | |
=> Bool | should use channel cache? |
-> ERProcessName | |
-> ChannelType | in, out channel type |
-> a | sample answer (without QAIxA) to identify protocol type |
-> ERProcess sInAnyProt sOutAnyProt |
A trivial passthrough process that only:
- reduces prec by 1 in all queries
- ensures that the granularity of all answers is raised to prec