urbit/pkg/hs/urbit-king/TODO.md

3.7 KiB

New IPC Protocol

Stubbed out:

  • Handle replacement events (stubbed out now b/c interface can't handle unparsed nouns)
  • Handle IPC errors by killing serf process.
  • Handle peek and pack in swimming flow.
  • Documentation for Urbit.Vere.Serf.IPC.
  • Unstub slog/stder/dead callbacks on serf config.
  • Remove GoodParse hack in newRunCompute.
  • Bring back tank printing.
  • Handle serf stderr message correctly.
  • Bring back logEvent.
  • Snapshots should block until that event is commited to disk.
  • Hook up error callbacks to IO Drivers.
  • Do something useful with error callbacks from IO Drivers.

Bugs:

  • king new should reject pier directories that already exist.
  • In non-daemon-mode, ^D doesn't bring down Urbit properly.

King-Haskell specific features:

  • Re-implement collectFX flow in Serf/Pier.
  • Hook up collectFX to CLI.
  • Get collect-all-fx flow working again.

Performance:

  • Batching during replay.
  • Batching during normal operation.

Polish:

  • Cleanup batching flow.
  • Think through how to shutdown the serf on exception.
  • King should shutdown promptly on ^C. Always takes 2s in practice.
  • Bring back progress bars.
  • Make sure replay progress bars go to stderr.
  • Logging for new IPC flow.
  • Logging for boot sequence.
  • Take snapshots on clean shutdown.

Misc Bugs

  • king run --collect-fx flag does nothing. Remove or implement.
  • Handle ^C in connected terminals. It should interrupt current event (send SIGINT to serf, which will cause the current event to fail promptly).
  • The terminal driver seems to have a race condition when spinner changed too quickly.

Cleanup

  • ShutdownSTM action that's passed to the terminal driver should live in KingEnv and should be available to all drivers.
  • Break most logic from Main.hs out into modules.
  • Simplify Main.hs flows.
  • Cleanup Terminal Driver code.
  • Spin off racquire into it's own package.
  • Spin off urbit-noun-core and urbit-noun packages.
  • Spin off urbit-eventlog-lmdb into it's own package.
  • Spin off Urbit.Vere.Serf into it's own package
    • Make it care less about the shape of events and effects.
  • Spin off per-pier logic into it's own package.
    • Probably urbit-pier

Event Prioritization

  • Instead of each IO driver being passed a TQueue EvErr, each IO driver produces a (STM (Maybe RunReq)).

    • Each driver has it's own event queue that feeds this action.

    • Pier has a thread that pulls from these actions with prioritization.

  • Priority:

    • If any terminal events are available, send it.
      • If serf queue is full, abort transaction and retry.
    • If no terminal events are available, do the same thing with sync driver.
    • Next, same thing for behn.
    • Next, same thing for iris.
    • Next, same thing for ames.
    • Next, same thing for eyre.

Better IO Driver Startup Flow Separation

Should have a io-driver-boot stage.

  • IO drivers do their boot flows.
  • When they're done, they signal that they're running.
  • No semantically important communication without outside world can happen until all drivers are up.

Current IO Driver interface is something like:

behn :: KingId -> (EvErr -> STM ()) -> ([EvErr], Acquire (BehnEf -> IO ()))

New Interface should be something like:

data DriverApi = DriverApi
  { eventQueue     :: STM (Maybe RunReq)
  , effectSink     :: Effect -> STM ()
  , blockUntilBorn :: STM ()
  }

behn :: HasPierEnv e => RAcquire e DriverApi

where PierEnv contains blockUntilAllDriversBorn :: STM ().

Finding the Serf Executable

Right now, urbit-worker is found by looking it up in the PATH. This is wrong, but what is right?