Skip to content

Commit 4c7d92b

Browse files
author
Adriano Santos
committed
refactor: rename from HordePro to Horde
1 parent 27358d1 commit 4c7d92b

42 files changed

Lines changed: 205 additions & 209 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.envrc.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export POSTGRES_URL="ecto://postgres:postgres@localhost:6431/horde_pro"
1+
export POSTGRES_URL="ecto://postgres:postgres@localhost:6431/horde"
22
export MIX_ENV=test

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
test:
88
runs-on: ubuntu-latest
99
env:
10-
POSTGRES_URL: "ecto://postgres:postgres@localhost:5431/horde_pro"
10+
POSTGRES_URL: "ecto://postgres:postgres@localhost:5431/horde"
1111
MIX_ENV: "test"
1212

1313
strategy:
@@ -31,7 +31,7 @@ jobs:
3131
env:
3232
POSTGRES_PASSWORD: postgres
3333
POSTGRES_USER: postgres
34-
POSTGRES_DB: horde_pro
34+
POSTGRES_DB: horde
3535
POSTGRES_PORT: 5431
3636

3737
name: Tests
@@ -50,4 +50,4 @@ jobs:
5050
- run: mix format --check-formatted
5151
if: matrix.elixir-version == 1.17 && matrix.otp-version == 27
5252

53-
- run: mix do ecto.create --quiet -r HordeProTest.Repo, ecto.migrate -r HordeProTest.Repo, test
53+
- run: mix do ecto.create --quiet -r HordeTest.Repo, ecto.migrate -r HordeTest.Repo, test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ erl_crash.dump
2020
*.ez
2121

2222
# Ignore package tarball (built via "mix hex.build").
23-
horde_pro-*.tar
23+
horde-*.tar
2424

2525
# Temporary files, for example, from tests.
2626
/tmp/

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
1-
# HordePro
1+
# Horde
22
<!-- MDOC !-->
33

4-
`HordePro` is a Postgres-backed distributed supervisor and registry.
4+
`Horde` is a distributed Supervisor and Registry.
55

6-
HordePro shares no code with Horde and has been completely re-written from the ground up, using what I learned from Horde and the better part of a decade in hindsight.
6+
This version of Horde reflects years of practical experience with Elixir and distributed systems. It introduces a refined architecture focused on stability, maintainability, and ease of operation, while keeping the API familiar to existing users.
77

8-
HordePro is backed by Postgres rather than the CRDT library that Horde uses (also written by me). I think this is a better choice for most users, since Postgres is already a singleton in most stacks, and this allows me to simplify things considerably. As such, HordePro should be more stable and easier to maintain and extend.
8+
One of the key design choices is the use of Postgres as the coordination back-end. Since Postgres is already a reliable singleton component in most stacks, this allows Horde to simplify its internal design and offer more predictable operational behavior.
99

10-
HordePro remains 99% API-compatible with `Elixir.DynamicSupervisor` and `Elixir.Registry`, and improves upon the API coverage offered in Horde.
10+
Horde remains 99% API-compatible with `Elixir.DynamicSupervisor` and `Elixir.Registry`, and improves upon the API coverage offered in Horde.
1111

12-
Currently HordePro only supports Postgres as a back-end. If you are interested in running it against MariaDB or something else, please get in touch with me.
12+
At the moment, Horde supports Postgres as its back-end. If you are interested in using other databases, such as MariaDB, feel free to reach out.
1313

14-
See `HordePro.DynamicSupervisor` and `HordePro.Registry` for documentation.
15-
16-
## Getting Started
17-
18-
Purchase a subscription to HordePro at Code Code Ship.
14+
Refer to `Horde.DynamicSupervisor` and `Horde.Registry` for detailed documentation.
1915

2016
## Installation
2117

2218
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
23-
by adding `horde_pro` to your list of dependencies in `mix.exs`:
19+
by adding `horde` to your list of dependencies in `mix.exs`:
2420

2521
```elixir
2622
def deps do
2723
[
28-
{:horde_pro, "~> 0.1.0"}
24+
{:horde, "~> 0.1.0"}
2925
]
3026
end
3127
```
3228

3329
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
3430
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
35-
be found at <https://hexdocs.pm/horde_pro>.
31+
be found at <https://hexdocs.pm/horde>.
3632

TODOS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
- use LISTEN / NOTIFY instead of polling in *Manager
2222

2323
## Considering
24-
- HordePro.Supervisor
24+
- Horde.Supervisor
2525
- I have seen this being requested a number of times. Sometimes people want to start a static list of processes and have them be uniformly distributed across their cluster. Perhaps we can meet this use case.

benchmarks/dynamic_supervisor_insert.exs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
defmodule HordeProTest.Repo do
1+
defmodule HordeTest.Repo do
22
use Ecto.Repo,
3-
otp_app: :horde_pro,
3+
otp_app: :horde,
44
adapter: Ecto.Adapters.Postgres
55

66
def init(_context, config) do
@@ -13,7 +13,7 @@ defmodule HordeProTest.Repo do
1313
end
1414
end
1515

16-
{:ok, _pid} = HordeProTest.Repo.start_link()
16+
{:ok, _pid} = HordeTest.Repo.start_link()
1717

1818
Logger.configure(level: :critical)
1919

@@ -38,7 +38,7 @@ Benchee.run(
3838
Task.async_stream(
3939
cases,
4040
fn n ->
41-
HordePro.DynamicSupervisorChild.encode(
41+
Horde.DynamicSupervisorChild.encode(
4242
%{supervisor_id: "123_123", lock_id: -2_329_838},
4343
self(),
4444
child_spec.start,
@@ -47,7 +47,7 @@ Benchee.run(
4747
:worker,
4848
[]
4949
)
50-
|> HordeProTest.Repo.insert()
50+
|> HordeTest.Repo.insert()
5151
end,
5252
max_concurrency: parallel
5353
)
@@ -85,15 +85,15 @@ Benchee.run(
8585

8686
pids
8787
end,
88-
"HordePro.DynamicSupervisor.start_child/3" => fn {pids, {cases, parallel}} ->
88+
"Horde.DynamicSupervisor.start_child/3" => fn {pids, {cases, parallel}} ->
8989
bench_pid = self()
9090

9191
Task.async_stream(
9292
cases,
9393
fn n ->
9494
{:ok, _child_pid} =
95-
HordePro.DynamicSupervisor.start_child(
96-
{:via, PartitionSupervisor, {HordeProSupervisor, n}},
95+
Horde.DynamicSupervisor.start_child(
96+
{:via, PartitionSupervisor, {HordeSupervisor, n}},
9797
{Task,
9898
fn ->
9999
send(bench_pid, {:msg, n})
@@ -122,14 +122,14 @@ Benchee.run(
122122

123123
{:ok, sup1} =
124124
PartitionSupervisor.start_link(
125-
name: HordeProSupervisor,
125+
name: HordeSupervisor,
126126
partitions: parallel,
127127
child_spec:
128-
HordePro.DynamicSupervisor.child_spec(
128+
Horde.DynamicSupervisor.child_spec(
129129
strategy: :one_for_one,
130130
backend:
131-
HordePro.Adapter.Postgres.DynamicSupervisorBackend.new(
132-
repo: HordeProTest.Repo,
131+
Horde.Adapter.Postgres.DynamicSupervisorBackend.new(
132+
repo: HordeTest.Repo,
133133
supervisor_id: "benchmark_#{ref}"
134134
)
135135
)

benchmarks/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defmodule HordeBench.MixProject do
2323
[
2424
{:benchee, "> 0.0.0"},
2525
{:horde, "> 0.0.0"},
26-
{:horde_pro, path: ".."},
26+
{:horde, path: ".."},
2727
{:sql_fmt, "> 0.0.0"}
2828
]
2929
end

benchmarks/registry_replication.exs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
defmodule HordeProTest.Repo do
1+
defmodule HordeTest.Repo do
22
use Ecto.Repo,
3-
otp_app: :horde_pro,
3+
otp_app: :horde,
44
adapter: Ecto.Adapters.Postgres
55

66
def init(_context, config) do
@@ -13,10 +13,10 @@ defmodule HordeProTest.Repo do
1313
end
1414
end
1515

16-
{:ok, _pid} = HordeProTest.Repo.start_link()
16+
{:ok, _pid} = HordeTest.Repo.start_link()
1717

18-
defmodule HordeProTest.Telemetry do
19-
def handle_event([:horde_pro_test, :repo, :query], measurements, metadata, config) do
18+
defmodule HordeTest.Telemetry do
19+
def handle_event([:horde_test, :repo, :query], measurements, metadata, config) do
2020
IO.inspect(metadata, label: "METADATA")
2121

2222
measurements
@@ -31,8 +31,8 @@ tel_attach = fn ->
3131
:ok =
3232
:telemetry.attach(
3333
"foo",
34-
[:horde_pro_test, :repo, :query],
35-
&HordeProTest.Telemetry.handle_event/4,
34+
[:horde_test, :repo, :query],
35+
&HordeTest.Telemetry.handle_event/4,
3636
%{}
3737
)
3838
end
@@ -77,10 +77,10 @@ Benchee.run(
7777

7878
pids
7979
end,
80-
"HordePro.Registry replication" => fn {pids, {cases, _parallel}} ->
80+
"Horde.Registry replication" => fn {pids, {cases, _parallel}} ->
8181
Enum.each(cases, fn n ->
8282
Task.start_link(fn ->
83-
HordePro.Registry.register(HordeProRegistry, "hello_#{n}", :value)
83+
Horde.Registry.register(HordeRegistry, "hello_#{n}", :value)
8484
Process.sleep(20_000)
8585
end)
8686
end)
@@ -90,7 +90,7 @@ Benchee.run(
9090
while(fn ->
9191
Process.sleep(2)
9292

93-
last != HordePro.Registry.count(HordeProRegistry2)
93+
last != Horde.Registry.count(HordeRegistry2)
9494
end)
9595

9696
pids
@@ -103,7 +103,7 @@ Benchee.run(
103103
# Task.async_stream(
104104
# cases,
105105
# fn n ->
106-
# HordePro.DynamicSupervisorChild.encode(
106+
# Horde.DynamicSupervisorChild.encode(
107107
# %{supervisor_id: "123_123", lock_id: -2_329_838},
108108
# self(),
109109
# child_spec.start,
@@ -112,7 +112,7 @@ Benchee.run(
112112
# :worker,
113113
# []
114114
# )
115-
# |> HordeProTest.Repo.insert()
115+
# |> HordeTest.Repo.insert()
116116
# end,
117117
# max_concurrency: parallel
118118
# )
@@ -150,15 +150,15 @@ Benchee.run(
150150

151151
# pids
152152
# end,
153-
# "HordePro.DynamicSupervisor.start_child/3" => fn {pids, {cases, parallel}} ->
153+
# "Horde.DynamicSupervisor.start_child/3" => fn {pids, {cases, parallel}} ->
154154
# bench_pid = self()
155155

156156
# Task.async_stream(
157157
# cases,
158158
# fn n ->
159159
# {:ok, _child_pid} =
160-
# HordePro.DynamicSupervisor.start_child(
161-
# {:via, PartitionSupervisor, {HordeProSupervisor, n}},
160+
# Horde.DynamicSupervisor.start_child(
161+
# {:via, PartitionSupervisor, {HordeSupervisor, n}},
162162
# {Task,
163163
# fn ->
164164
# send(bench_pid, {:msg, n})
@@ -202,24 +202,24 @@ Benchee.run(
202202
Horde.Cluster.set_members(HordeRegistry, [HordeRegistry, HordeRegistry2])
203203

204204
{:ok, reg1} =
205-
HordePro.Registry.start_link(
206-
name: HordeProRegistry,
205+
Horde.Registry.start_link(
206+
name: HordeRegistry,
207207
keys: :unique,
208208
backend:
209-
HordePro.Adapter.Postgres.RegistryBackend.new(
210-
repo: HordeProTest.Repo,
209+
Horde.Adapter.Postgres.RegistryBackend.new(
210+
repo: HordeTest.Repo,
211211
registry_id: "registry_#{ref}"
212212
),
213213
partitions: parallel
214214
)
215215

216216
{:ok, reg1_2} =
217-
HordePro.Registry.start_link(
218-
name: HordeProRegistry2,
217+
Horde.Registry.start_link(
218+
name: HordeRegistry2,
219219
keys: :unique,
220220
backend:
221-
HordePro.Adapter.Postgres.RegistryBackend.new(
222-
repo: HordeProTest.Repo,
221+
Horde.Adapter.Postgres.RegistryBackend.new(
222+
repo: HordeTest.Repo,
223223
registry_id: "registry_#{ref}"
224224
),
225225
partitions: parallel

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
environment:
77
POSTGRES_USER: postgres
88
POSTGRES_PASSWORD: postgres
9-
POSTGRES_DB: horde_pro
9+
POSTGRES_DB: horde
1010
POSTGRES_PORT: 6431
1111
command: postgres -c shared_buffers=256MB -c max_connections=200
1212

justfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ watch:
1616
watchexec -r --clear=reset -w . --project-origin=. --stop-timeout=0 mix test --warnings-as-errors --all-warnings
1717

1818
watch2:
19-
watchexec -r --clear=reset -w . --project-origin=. --stop-timeout=0 mix test --warnings-as-errors --all-warnings test/horde_pro/registry_test.exs
19+
watchexec -r --clear=reset -w . --project-origin=. --stop-timeout=0 mix test --warnings-as-errors --all-warnings test/horde/registry_test.exs
2020

2121
watch3:
22-
watchexec -r --clear=reset -w . --project-origin=. --stop-timeout=0 mix test --warnings-as-errors --all-warnings test/horde_pro/adapter/postgres/locker_test.exs
22+
watchexec -r --clear=reset -w . --project-origin=. --stop-timeout=0 mix test --warnings-as-errors --all-warnings test/horde/adapter/postgres/locker_test.exs
2323

2424
migrate:
25-
MIX_ENV=test mix ecto.migrate -r HordeProTest.Repo
25+
MIX_ENV=test mix ecto.migrate -r HordeTest.Repo
2626

2727
db_reset:
28-
MIX_ENV=test mix do ecto.drop -r HordeProTest.Repo, ecto.create -r HordeProTest.Repo, ecto.migrate -r HordeProTest.Repo
28+
MIX_ENV=test mix do ecto.drop -r HordeTest.Repo, ecto.create -r HordeTest.Repo, ecto.migrate -r HordeTest.Repo
2929

3030
gen_migration MIG:
31-
MIX_ENV=test mix ecto.gen.migration -r HordeProTest.Repo {{MIG}}
31+
MIX_ENV=test mix ecto.gen.migration -r HordeTest.Repo {{MIG}}

0 commit comments

Comments
 (0)