Files
2026-03-09 23:09:46 -04:00

58 lines
1.6 KiB
Clojure

(ns Supervisor
"Elixir Supervisor module — OTP supervisor for fault-tolerant process trees.
In CljElixir: (Supervisor/start-link children opts), etc.
Strategies: :one-for-one, :one-for-all, :rest-for-one.")
(defn start-link
"Starts a supervisor with child specifications.
(Supervisor/start-link [{MyWorker [arg1]}] :strategy :one-for-one)
(Supervisor/start-link MyApp [init-arg])"
([children-or-module opts-or-arg])
([module arg opts]))
(defn start-child
"Dynamically starts a child under the supervisor.
(Supervisor/start-child sup child-spec)"
[supervisor child-spec])
(defn terminate-child
"Terminates a child process.
(Supervisor/terminate-child sup child-id)"
[supervisor child-id])
(defn restart-child
"Restarts a terminated child.
(Supervisor/restart-child sup child-id)"
[supervisor child-id])
(defn delete-child
"Deletes a terminated child specification.
(Supervisor/delete-child sup child-id)"
[supervisor child-id])
(defn which-children
"Returns a list of all children with their info.
(Supervisor/which-children sup) ;=> [{id, pid, type, modules} ...]"
[supervisor])
(defn count-children
"Returns a map with child counts by status.
(Supervisor/count-children sup) ;=> %{active: 2, specs: 2, supervisors: 0, workers: 2}"
[supervisor])
(defn stop
"Stops the supervisor.
(Supervisor/stop sup) ;=> :ok"
([supervisor])
([supervisor reason])
([supervisor reason timeout]))
(defn child-spec
"Builds a child specification map."
[module overrides])
(defn init
"Returns supervisor init spec. For use in module-based supervisors."
[children-and-opts])