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

3.1 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.
  • Make sure replay progress bars go to stderr.

Bugs:

  • 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.
  • Logging for new IPC flow.
  • Logging for boot sequence.
  • Bring back progress bars.

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 PierEnv 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 Urbit.Noun into it's own package.

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.

Something like:

data DriverConfig = DriverConfig
  { onAllDriversUp :: STM ()
  }

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

type Driver = DriverConfig -> RIO e DriverApi