-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell CloudI API -- -- Haskell CloudI API (see https://cloudi.org for more details) @package cloudi @version 2.0.5 module Foreign.Erlang.Function data Function Function :: !Word8 -> !ByteString -> Function [tag] :: Function -> !Word8 [value] :: Function -> !ByteString instance GHC.Show.Show Foreign.Erlang.Function.Function instance GHC.Classes.Eq Foreign.Erlang.Function.Function instance GHC.Classes.Ord Foreign.Erlang.Function.Function module Foreign.Erlang.Pid data Pid Pid :: !Word8 -> !ByteString -> !ByteString -> !ByteString -> !ByteString -> Pid [nodeTag] :: Pid -> !Word8 [node] :: Pid -> !ByteString [id] :: Pid -> !ByteString [serial] :: Pid -> !ByteString [creation] :: Pid -> !ByteString instance GHC.Show.Show Foreign.Erlang.Pid.Pid instance GHC.Classes.Eq Foreign.Erlang.Pid.Pid instance GHC.Classes.Ord Foreign.Erlang.Pid.Pid module Foreign.Erlang.Port data Port Port :: !Word8 -> !ByteString -> !ByteString -> !ByteString -> Port [nodeTag] :: Port -> !Word8 [node] :: Port -> !ByteString [id] :: Port -> !ByteString [creation] :: Port -> !ByteString instance GHC.Show.Show Foreign.Erlang.Port.Port instance GHC.Classes.Eq Foreign.Erlang.Port.Port instance GHC.Classes.Ord Foreign.Erlang.Port.Port module Foreign.Erlang.Reference data Reference Reference :: !Word8 -> !ByteString -> !ByteString -> !ByteString -> Reference [nodeTag] :: Reference -> !Word8 [node] :: Reference -> !ByteString [id] :: Reference -> !ByteString [creation] :: Reference -> !ByteString instance GHC.Show.Show Foreign.Erlang.Reference.Reference instance GHC.Classes.Eq Foreign.Erlang.Reference.Reference instance GHC.Classes.Ord Foreign.Erlang.Reference.Reference -- | Erlang External Term Format Encoding/Decoding module Foreign.Erlang data OtpErlangTerm OtpErlangInteger :: Int -> OtpErlangTerm OtpErlangIntegerBig :: Integer -> OtpErlangTerm OtpErlangFloat :: Double -> OtpErlangTerm OtpErlangAtom :: ByteString -> OtpErlangTerm OtpErlangAtomUTF8 :: ByteString -> OtpErlangTerm OtpErlangAtomCacheRef :: Int -> OtpErlangTerm OtpErlangAtomBool :: Bool -> OtpErlangTerm OtpErlangString :: ByteString -> OtpErlangTerm OtpErlangBinary :: ByteString -> OtpErlangTerm OtpErlangBinaryBits :: (ByteString, Int) -> OtpErlangTerm OtpErlangList :: [OtpErlangTerm] -> OtpErlangTerm OtpErlangListImproper :: [OtpErlangTerm] -> OtpErlangTerm OtpErlangTuple :: [OtpErlangTerm] -> OtpErlangTerm OtpErlangMap :: Map OtpErlangTerm OtpErlangTerm -> OtpErlangTerm OtpErlangPid :: Pid -> OtpErlangTerm OtpErlangPort :: Port -> OtpErlangTerm OtpErlangReference :: Reference -> OtpErlangTerm OtpErlangFunction :: Function -> OtpErlangTerm data Error InputError :: String -> Error OutputError :: String -> Error ParseError :: String -> Error type Result a = Either Error a -- | Decode Erlang terms within binary data into Haskell types binaryToTerm :: LazyByteString -> Result OtpErlangTerm -- | Encode Haskell types into Erlang terms in binary data termToBinary :: OtpErlangTerm -> Int -> Result LazyByteString instance GHC.Show.Show Foreign.Erlang.OtpErlangTerm instance GHC.Classes.Eq Foreign.Erlang.OtpErlangTerm instance GHC.Classes.Ord Foreign.Erlang.OtpErlangTerm instance GHC.Show.Show Foreign.Erlang.Error instance GHC.Classes.Eq Foreign.Erlang.Error -- | Haskell CloudI API. Example usage is available in the -- integration tests. module Foreign.CloudI -- | provided when handling a service request data RequestType ASYNC :: RequestType SYNC :: RequestType -- | the Erlang pid that is the source of the service request type Source = Pid -- | service request callback function return type data Response s Response :: (ByteString, s, T s) -> Response s ResponseInfo :: (ByteString, ByteString, s, T s) -> Response s Forward :: (ByteString, ByteString, ByteString, s, T s) -> Response s Forward_ :: (ByteString, ByteString, ByteString, Int, Int, s, T s) -> Response s Null :: (s, T s) -> Response s NullError :: (String, s, T s) -> Response s -- | a function to handle a service request type Callback s = RequestType -> ByteString -> ByteString -> ByteString -> ByteString -> Int -> Int -> ByteString -> Source -> s -> T s -> IO (Response s) -- | an instance of the CloudI API data T s -- | a null trans_id is used to check for a timeout or to get the oldest -- response with recv_async transIdNull :: ByteString invalidInputError :: String messageDecodingError :: String terminateError :: String data Exception s data FatalError type Result a = Either String a -- | creates an instance of the CloudI API api :: Typeable s => Int -> s -> Maybe Bool -> IO (Result (T s)) -- | returns the thread count from the service configuration threadCount :: IO (Result Int) -- | subscribes to a service name pattern with a callback subscribe :: T s -> ByteString -> Callback s -> IO (Result (T s)) -- | returns the number of subscriptions for a single service name pattern subscribeCount :: Typeable s => T s -> ByteString -> IO (Result (Int, T s)) -- | unsubscribes from a service name pattern once unsubscribe :: T s -> ByteString -> IO (Result (T s)) -- | sends an asynchronous service request sendAsync :: Typeable s => T s -> ByteString -> ByteString -> Maybe Int -> Maybe ByteString -> Maybe Int -> IO (Result (ByteString, T s)) -- | sends a synchronous service request sendSync :: Typeable s => T s -> ByteString -> ByteString -> Maybe Int -> Maybe ByteString -> Maybe Int -> IO (Result (ByteString, ByteString, ByteString, T s)) -- | sends asynchronous service requests to all subscribers of the matching -- service name pattern mcastAsync :: Typeable s => T s -> ByteString -> ByteString -> Maybe Int -> Maybe ByteString -> Maybe Int -> IO (Result (Array Int ByteString, T s)) -- | forwards a service request to a different service name forward_ :: Typeable s => T s -> RequestType -> ByteString -> ByteString -> ByteString -> Int -> Int -> ByteString -> Source -> IO () -- | forwards an asynchronous service request to a different service name forwardAsync :: Typeable s => T s -> ByteString -> ByteString -> ByteString -> Int -> Int -> ByteString -> Source -> IO () -- | forwards a synchronous service request to a different service name forwardSync :: Typeable s => T s -> ByteString -> ByteString -> ByteString -> Int -> Int -> ByteString -> Source -> IO () -- | provides a response to a service request return_ :: Typeable s => T s -> RequestType -> ByteString -> ByteString -> ByteString -> ByteString -> Int -> ByteString -> Source -> IO () -- | provides a response to an asynchronous service request returnAsync :: Typeable s => T s -> ByteString -> ByteString -> ByteString -> ByteString -> Int -> ByteString -> Source -> IO () -- | provides a response to a synchronous service request returnSync :: Typeable s => T s -> ByteString -> ByteString -> ByteString -> ByteString -> Int -> ByteString -> Source -> IO () -- | blocks to receive an asynchronous service request response recvAsync :: Typeable s => T s -> Maybe Int -> Maybe ByteString -> Maybe Bool -> IO (Result (ByteString, ByteString, ByteString, T s)) -- | returns the 0-based index of this process in the service instance processIndex :: T s -> Int -- | returns the current process count based on the service configuration processCount :: T s -> Int -- | returns the count_process_dynamic maximum count based on the service -- configuration processCountMax :: T s -> Int -- | returns the count_process_dynamic minimum count based on the service -- configuration processCountMin :: T s -> Int -- | returns the service name pattern prefix from the service configuration prefix :: T s -> ByteString -- | returns the service initialization timeout from the service -- configuration timeoutInitialize :: T s -> Int -- | returns the default asynchronous service request send timeout from the -- service configuration timeoutAsync :: T s -> Int -- | returns the default synchronous service request send timeout from the -- service configuration timeoutSync :: T s -> Int -- | returns the service termination timeout based on the service -- configuration timeoutTerminate :: T s -> Int -- | returns the default service request send priority from the service -- configuration priorityDefault :: T s -> Int -- | blocks to process incoming CloudI service requests poll :: Typeable s => T s -> Int -> IO (Result (Bool, T s)) -- | shutdown the service successfully shutdown :: T s -> Maybe ByteString -> IO (Result (T s)) -- | simplifies thread creation and join -- --
-- Concurrent.setNumCapabilities threadCount -- mapM_ (CloudI.threadCreate task) [0..threadCount - 1] -- CloudI.threadsWait --threadCreate :: (Int -> IO ()) -> Int -> IO ThreadId -- | wait for threads to join after being created by threadCreate threadsWait :: IO () -- | decode service request info key/value data infoKeyValueParse :: ByteString -> Map ByteString [ByteString] -- | encode service response info key/value data infoKeyValueNew :: Map ByteString [ByteString] -> Maybe Bool -> ByteString instance GHC.Show.Show (Foreign.CloudI.Exception s) instance GHC.Exception.Type.Exception Foreign.CloudI.FatalError instance GHC.Show.Show Foreign.CloudI.FatalError instance Data.Typeable.Internal.Typeable s => GHC.Exception.Type.Exception (Foreign.CloudI.Exception s)