-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmix.exs
More file actions
121 lines (109 loc) · 3.07 KB
/
mix.exs
File metadata and controls
121 lines (109 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
defmodule Vsr.MixProject do
use Mix.Project
def project do
[
app: :vsr,
version: "0.1.0",
elixir: "~> 1.18",
start_permanent: Mix.env() == :prod,
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env()),
elixirc_options: elixirc_options(Mix.env()),
aliases: aliases(),
description: description(),
package: package(),
source_url: "https://github.com/ityonemo/vsr",
homepage_url: "https://github.com/ityonemo/vsr",
docs: docs()
]
end
defp description do
"""
Viewstamped Replication (VSR) consensus protocol implementation for Elixir.
Provides fault-tolerant state machine replication with automatic failure recovery,
primary-backup replication, and comprehensive telemetry instrumentation.
"""
end
defp package do
[
name: "vsr",
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/ityonemo/vsr"
},
files: ~w(lib .formatter.exs mix.exs README.md LICENSE CHANGELOG.md)
]
end
defp docs do
[
main: "VsrServer",
extras: ["README.md", "CHANGELOG.md", "SPECIFICATION.md", "TELEMETRY_EVENTS.md"],
groups_for_modules: [
"Core": [VsrServer],
"Messages": [
Vsr.Message,
Vsr.Message.ClientRequest,
Vsr.Message.Prepare,
Vsr.Message.PrepareOk,
Vsr.Message.Commit,
Vsr.Message.StartViewChange,
Vsr.Message.DoViewChange,
Vsr.Message.StartView,
Vsr.Message.GetState,
Vsr.Message.NewState,
Vsr.Message.Heartbeat
],
"Support": [Vsr.LogEntry, Vsr.Telemetry]
]
]
end
defp use_mcp, do: System.get_env("USE_MCPS") == "true"
defp aliases do
List.wrap(
if use_mcp(),
do: {
:mcps,
"run --no-halt -e 'Agent.start(fn -> Bandit.start_link(plug: Tidewave, port: 4000); Bandit.start_link(plug: Codicil.Plug, port: 4700) end)'"
}
)
end
# Run "mix help compile.app" to learn about applications.
def application do
case Mix.env() do
:maelstrom ->
[
extra_applications: [:logger, :sasl],
mod: {Maelstrom.Application, []}
]
_ ->
[
extra_applications: [:logger, :runtime_tools]
]
end
end
def elixirc_paths(:test), do: ["lib", "test/_support", "maelstrom-adapter"]
def elixirc_paths(:maelstrom), do: ["lib", "maelstrom-adapter", "test/_support"]
def elixirc_paths(_), do: ["lib"]
defp elixirc_options(_env), do: []
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:telemetry, "~> 1.0"},
{:mox, "~> 1.0", only: :test},
{:ex_doc, "~> 0.34", only: :dev, runtime: false}
] ++ mcp_tools()
end
defp mcp_tools do
List.wrap(
if use_mcp() do
[
# MCP TOOLS
{:tidewave, "~> 0.4", only: :dev},
{:bandit, "~> 1.0", only: [:dev, :test]},
# "~> 0.2", only: [:dev, :test]}
{:codicil, path: "../codicil", only: [:dev, :test]}
]
end
)
end
end