Cherrypicker.State (cherrypicker v0.1.0)

Copy Markdown View Source

The daemon's discovery file: ~/.cherrypicker/daemon.json, holding the bound proxy port. Written by the daemon on start, removed on clean shutdown, read by every client that needs to find the control API without being told where it is.

A stale file (daemon crashed) is possible; clients treat "file present but nothing answers" as :no_daemon, so staleness costs one failed connect, never a wrong answer.

Summary

Functions

Where the state file lives; override with CHERRYPICKER_HOME for tests.

Types

info()

@type info() :: %{port: :inet.port_number()}

Functions

path()

@spec path() :: Path.t()

Where the state file lives; override with CHERRYPICKER_HOME for tests.

read()

@spec read() :: {:ok, info()} | :error

remove()

@spec remove() :: :ok

write(map)

@spec write(info()) :: :ok