butler-0.0.1.0: At your service.
Safe HaskellSafe-Inferred
LanguageGHC2021

Butler.Core

Synopsis

Boot

data OS #

Instances

Instances details
Generic OS # 
Instance details

Defined in Butler.Core

Associated Types

type Rep OS :: Type -> Type #

Methods

from :: OS -> Rep OS x #

to :: Rep OS x -> OS #

type Rep OS # 
Instance details

Defined in Butler.Core

spawnInitProcess :: RawFilePath -> ProcessIO a -> IO ExitReason #

Run the initial process with a given storage root directory.

data ProcessEnv #

Constructors

ProcessEnv 

Fields

Instances

Instances details
Generic ProcessEnv # 
Instance details

Defined in Butler.Core

Associated Types

type Rep ProcessEnv :: Type -> Type #

MonadReader ProcessEnv ProcessIO # 
Instance details

Defined in Butler.Core

type Rep ProcessEnv # 
Instance details

Defined in Butler.Core

type Rep ProcessEnv = D1 ('MetaData "ProcessEnv" "Butler.Core" "butler-0.0.1.0-inplace" 'False) (C1 ('MetaCons "ProcessEnv" 'PrefixI 'True) (S1 ('MetaSel ('Just "os") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OS) :*: S1 ('MetaSel ('Just "process") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Process)))

data ProcessIO a #

Instances

Instances details
MonadFail ProcessIO # 
Instance details

Defined in Butler.Core

Methods

fail :: String -> ProcessIO a #

MonadIO ProcessIO # 
Instance details

Defined in Butler.Core

Methods

liftIO :: IO a -> ProcessIO a #

Applicative ProcessIO # 
Instance details

Defined in Butler.Core

Methods

pure :: a -> ProcessIO a #

(<*>) :: ProcessIO (a -> b) -> ProcessIO a -> ProcessIO b #

liftA2 :: (a -> b -> c) -> ProcessIO a -> ProcessIO b -> ProcessIO c #

(*>) :: ProcessIO a -> ProcessIO b -> ProcessIO b #

(<*) :: ProcessIO a -> ProcessIO b -> ProcessIO a #

Functor ProcessIO # 
Instance details

Defined in Butler.Core

Methods

fmap :: (a -> b) -> ProcessIO a -> ProcessIO b #

(<$) :: a -> ProcessIO b -> ProcessIO a #

Monad ProcessIO # 
Instance details

Defined in Butler.Core

Methods

(>>=) :: ProcessIO a -> (a -> ProcessIO b) -> ProcessIO b #

(>>) :: ProcessIO a -> ProcessIO b -> ProcessIO b #

return :: a -> ProcessIO a #

MonadUnliftIO ProcessIO # 
Instance details

Defined in Butler.Core

Methods

withRunInIO :: ((forall a. ProcessIO a -> IO a) -> IO b) -> ProcessIO b #

MonadReader ProcessEnv ProcessIO # 
Instance details

Defined in Butler.Core

runExternalProcess :: Text -> ProcessConfig stdin stdout0 stderr0 -> ProcessIO () #

Memory api

chroot :: StorageAddress -> ProcessIO a -> ProcessIO a #

Change the root storage directory of a process.

Processor api

spawnProcess :: ProgramName -> ProcessIO () -> ProcessIO Process #

Create a process.

stopProcess :: Process -> STM Bool #

Stop a process, returns False if the process did not received the message.

killProcess :: Pid -> ProcessIO Bool #

Lookup and kill the pid. Use stopProcess instead.

spawnThread_ :: ProcessIO Void -> ProcessIO () #

Create a child thread that never exit, for example to handle messages. If the thread crash, the whole process is terminated.

spawnThread :: ProcessIO a -> ProcessIO (Thread a) #

Create a child thread.

Log api

logDebug :: HasCallStack => Text -> [Pair] -> ProcessIO () #

Use logDebug for the rest.

logInfo :: HasCallStack => Text -> [Pair] -> ProcessIO () #

Use logInfo for nominal but important event.

logError :: HasCallStack => Text -> [Pair] -> ProcessIO () #

Use logError for unexpected mal-functions.

Clock api

IPC api

Helpers

Re-exports

newtype ProgramName #

Constructors

ProgramName Text 

Instances

Instances details
FromJSON ProgramName # 
Instance details

Defined in Butler.Core.Process

ToJSON ProgramName # 
Instance details

Defined in Butler.Core.Process

IsString ProgramName # 
Instance details

Defined in Butler.Core.Process

Semigroup ProgramName # 
Instance details

Defined in Butler.Core.Process

Generic ProgramName # 
Instance details

Defined in Butler.Core.Process

Associated Types

type Rep ProgramName :: Type -> Type #

Show ProgramName # 
Instance details

Defined in Butler.Core.Process

Eq ProgramName # 
Instance details

Defined in Butler.Core.Process

Ord ProgramName # 
Instance details

Defined in Butler.Core.Process

ToHtml ProgramName # 
Instance details

Defined in Butler.Core.Process

Methods

toHtml :: forall (m :: Type -> Type). Monad m => ProgramName -> HtmlT m () #

toHtmlRaw :: forall (m :: Type -> Type). Monad m => ProgramName -> HtmlT m () #

Serialise ProgramName # 
Instance details

Defined in Butler.Core.Process

From ProgramName Text # 
Instance details

Defined in Butler.Core.Process

Methods

from :: ProgramName -> Text #

From Text ProgramName # 
Instance details

Defined in Butler.Core.Process

Methods

from :: Text -> ProgramName #

From Natural ProgramName # 
Instance details

Defined in Butler.Core.Process

Methods

from :: Natural -> ProgramName #

type Rep ProgramName # 
Instance details

Defined in Butler.Core.Process

type Rep ProgramName = D1 ('MetaData "ProgramName" "Butler.Core.Process" "butler-0.0.1.0-inplace" 'True) (C1 ('MetaCons "ProgramName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Process #

A process is a killable thread.

Constructors

Process 

Fields

Instances

Instances details
ToJSON Process # 
Instance details

Defined in Butler.Core.Process

Show Process # 
Instance details

Defined in Butler.Core.Process

newtype ProcessAction #

Constructors

ProcessAction (Process -> IO ())