Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data OS = OS {}
- spawnInitProcess :: RawFilePath -> ProcessIO a -> IO ExitReason
- withButlerOS :: ProcessIO a -> IO ExitReason
- data ProcessEnv = ProcessEnv {}
- data ProcessIO a
- runProcessIO :: OS -> Process -> ProcessIO a -> IO a
- getSelfProcess :: ProcessIO Process
- asProcess :: ProcessEnv -> ProcessIO a -> ProcessIO a
- runExternalProcess :: Text -> ProcessConfig stdin stdout0 stderr0 -> ProcessIO ()
- getPath :: StorageAddress -> ProcessIO RawFilePath
- newProcessMemory :: Serialise a => StorageAddress -> ProcessIO a -> ProcessIO (a, MemoryVar a)
- chroot :: StorageAddress -> ProcessIO a -> ProcessIO a
- spawnProcess :: ProgramName -> ProcessIO () -> ProcessIO Process
- superviseProcess :: ProgramName -> ProcessIO Void -> ProcessIO Process
- stopProcess :: Process -> STM Bool
- killProcess :: Pid -> ProcessIO Bool
- spawnThread_ :: ProcessIO Void -> ProcessIO ()
- spawnThread :: ProcessIO a -> ProcessIO (Thread a)
- logSystem :: EventSeverity -> SystemEvent -> ProcessIO ()
- logDebug :: HasCallStack => Text -> [Pair] -> ProcessIO ()
- logInfo :: HasCallStack => Text -> [Pair] -> ProcessIO ()
- logError :: HasCallStack => Text -> [Pair] -> ProcessIO ()
- getTime :: ProcessIO Time
- writePipe :: HasCallStack => Pipe a -> a -> ProcessIO ()
- waitProcess :: MonadIO m => Process -> m ExitReason
- newtype ProgramName = ProgramName Text
- data Process = Process {}
- newtype ProcessAction = ProcessAction (Process -> IO ())
- data SystemEvent
Boot
Instances
Generic OS # | |
type Rep OS # | |
Defined in Butler.Core type Rep OS = D1 ('MetaData "OS" "Butler.Core" "butler-0.0.1.0-inplace" 'False) (C1 ('MetaCons "OS" 'PrefixI 'True) ((S1 ('MetaSel ('Just "processor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Processor) :*: S1 ('MetaSel ('Just "storage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Storage)) :*: (S1 ('MetaSel ('Just "clock") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Clock) :*: (S1 ('MetaSel ('Just "logger") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Logger SystemEvent)) :*: S1 ('MetaSel ('Just "buzzer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Buzzer))))) |
spawnInitProcess :: RawFilePath -> ProcessIO a -> IO ExitReason #
Run the initial process with a given storage root directory.
withButlerOS :: ProcessIO a -> IO ExitReason #
data ProcessEnv #
Instances
Generic ProcessEnv # | |
Defined in Butler.Core type Rep ProcessEnv :: Type -> Type # from :: ProcessEnv -> Rep ProcessEnv x # to :: Rep ProcessEnv x -> ProcessEnv # | |
MonadReader ProcessEnv ProcessIO # | |
Defined in Butler.Core ask :: ProcessIO ProcessEnv # local :: (ProcessEnv -> ProcessEnv) -> ProcessIO a -> ProcessIO a # reader :: (ProcessEnv -> a) -> ProcessIO a # | |
type Rep ProcessEnv # | |
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))) |
Instances
MonadFail ProcessIO # | |
Defined in Butler.Core | |
MonadIO ProcessIO # | |
Defined in Butler.Core | |
Applicative ProcessIO # | |
Functor ProcessIO # | |
Monad ProcessIO # | |
MonadUnliftIO ProcessIO # | |
Defined in Butler.Core | |
MonadReader ProcessEnv ProcessIO # | |
Defined in Butler.Core ask :: ProcessIO ProcessEnv # local :: (ProcessEnv -> ProcessEnv) -> ProcessIO a -> ProcessIO a # reader :: (ProcessEnv -> a) -> ProcessIO a # |
asProcess :: ProcessEnv -> ProcessIO a -> ProcessIO a #
runExternalProcess :: Text -> ProcessConfig stdin stdout0 stderr0 -> ProcessIO () #
Memory api
newProcessMemory :: Serialise a => StorageAddress -> ProcessIO a -> ProcessIO (a, MemoryVar a) #
chroot :: StorageAddress -> ProcessIO a -> ProcessIO a #
Change the root storage directory of a process.
Processor api
spawnProcess :: ProgramName -> ProcessIO () -> ProcessIO Process #
Create a process.
superviseProcess :: ProgramName -> ProcessIO Void -> ProcessIO 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
logSystem :: EventSeverity -> SystemEvent -> ProcessIO () #
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
writePipe :: HasCallStack => Pipe a -> a -> ProcessIO () #
Helpers
waitProcess :: MonadIO m => Process -> m ExitReason #
Re-exports
newtype ProgramName #
Instances
A process is a killable thread.
Process | |
|
newtype ProcessAction #
ProcessAction (Process -> IO ()) |
data SystemEvent #
ProcessCreated Process | |
ProcessStopped Process ExitReason | |
ProcessMessage ByteString Process Text | |
StorageSync Int | |
SystemReady | |
SystemCompleted | |
DaemonCrashed Process Int |
Instances
Show SystemEvent # | |
Defined in Butler.Core.Events showsPrec :: Int -> SystemEvent -> ShowS # show :: SystemEvent -> String # showList :: [SystemEvent] -> ShowS # | |
From SystemEvent Text # | |
Defined in Butler.Core.Events from :: SystemEvent -> Text # |