{"id":16389980,"url":"https://github.com/mnishiguchi/elixir_todo","last_synced_at":"2025-09-02T00:39:29.879Z","repository":{"id":84540687,"uuid":"82808058","full_name":"mnishiguchi/elixir_todo","owner":"mnishiguchi","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-02T23:40:56.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T18:50:07.934Z","etag":null,"topics":["elixir","erlang-otp","functional-programming"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnishiguchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-22T13:34:37.000Z","updated_at":"2017-03-30T22:02:13.000Z","dependencies_parsed_at":"2023-03-05T14:30:33.631Z","dependency_job_id":null,"html_url":"https://github.com/mnishiguchi/elixir_todo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mnishiguchi/elixir_todo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Felixir_todo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Felixir_todo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Felixir_todo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Felixir_todo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnishiguchi","download_url":"https://codeload.github.com/mnishiguchi/elixir_todo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Felixir_todo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273213953,"owners_count":25065059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","erlang-otp","functional-programming"],"created_at":"2024-10-11T04:34:41.630Z","updated_at":"2025-09-02T00:39:29.852Z","avatar_url":"https://github.com/mnishiguchi.png","language":"Elixir","readme":"# ElixirTodo\n\nThis is a simple OTP application, with which I practice Elixir programming along with the book \"Elixir in Action\" by Sasa Juric.\n\n---\n\n## Supervision tree\n\n```elixir\nTodo.Application\n  └── Todo.Supervisor (one_for_one) # The top-level supervisor.\n        └── Todo.SystemSupervisor (one_for_one) # The todo system.\n              ├── Todo.PoolSupervisor (one_for_one) # Start all the children from here.\n              │     ├── Todo.DatabaseWorker 1\n              │     ├── Todo.DatabaseWorker 2\n              │     ├── Todo.DatabaseWorker n\n              │     :\n              ├── Todo.ServerSupervisor (simple_one_for_one) # Start no child from here.\n              │     ├── Todo.Server 1 # Dynamically started on demand from a caller.\n              │     ├── Todo.Server 2 # Dynamically started on demand from a caller.\n              │     ├── Todo.Server n # Dynamically started on demand from a caller.\n              │     :\n              └── Todo.Cache # The interface for Todo.Server instances.\n```\n\n---\n\n## Usage\n\n```elixir\n# The app is automatically started.\n$ iex -S mix\n\n# Only one instance per application is allowed.\niex(1)\u003e Application.start(:elixir_todo)\n{:error, {:already_started, :elixir_todo}}\niex(2)\u003e Application.stop(:elixir_todo)\n:ok\n17:04:42.874 [info]  Application elixir_todo exited: :stopped\niex(3)\u003e Application.start(:elixir_todo)\n:ok\n```\n\n```elixir\n## Do some operations\n\npid = Todo.Cache.server_process(\"masa\")\npid |\u003e Todo.Server.all_entries\n\n## Check the number of processes\n\nlength :erlang.processes\n\n## Terminate a child process in the supervision tree to see if it restarts correctly\n\nProcess.whereis(:todo_cache)\nProcess.whereis(:todo_cache) |\u003e Process.exit(:kill)\n\n## Terminate an individual worker to see if it restarts correctly\n\n:gproc.whereis_name({:n, :l, {:database_worker, 2}})\n:gproc.whereis_name({:n, :l, {:database_worker, 2}}) |\u003e Process.exit(:kill)\n\n## Continue to do some operations\n\npid = Todo.Cache.server_process(\"masa\")\npid |\u003e Todo.Server.all_entries\n\n## Check the number of processes\n\nlength :erlang.processes\n\n## Kill Todo.Cache to see if it restarts correctly\n\nProcess.whereis(:todo_cache) |\u003e Process.exit(:kill)\n\n## Kill Todo.Database to see if it restarts correctly\n\nProcess.whereis(:database_server) |\u003e Process.exit(:kill)\n```\n\n---\n\n## Libraries\n\n### [gproc](https://github.com/uwiger/gproc)\nExtended process registry for Erlang\n\n```elixir\ndef start_link(todo_list_name) do\n  GenServer.start_link __MODULE__,\n                       todo_list_name,  \n                       name: via_tuple(todo_list_name)  # Register in the gproc registry\nend\n\ndefp via_tuple(todo_list_name) do\n  {\n    :via, :gproc, { :n,                            # type:  unique registration (:n)\n                    :l,                            # scope: local (:l)\n                    {:todo_server, todo_list_name} # complex alias\n                  }\n  }\nend\n\ndef whereis(todo_list_name) do\n  :gproc.whereis_name {:n, :l, {:todo_server, todo_list_name}}\nend\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Felixir_todo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnishiguchi%2Felixir_todo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Felixir_todo/lists"}