Skip to content

Commit 5322002

Browse files
Merge pull request #9 from diffo-dev/7-livebook
7 livebook
2 parents d21dc87 + 850ec47 commit 5322002

18 files changed

Lines changed: 345 additions & 161 deletions
File renamed without changes.

diffo.livemd

Lines changed: 137 additions & 84 deletions
Large diffs are not rendered by default.

lib/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](Https://conventionalcommits.org) for commit guidelines.
5+
6+
<!-- changelog -->
7+
8+
## [v0.1.0](https://github.com/diffo-dev/diffo/compare/v0.1.0...v0.1.0) (2025-08-10)
9+
10+
### Features:
11+
* initial version using Neo4j DataLayer
12+

lib/diffo/provider.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ defmodule Diffo.Provider do
4141
define :activate_service, action: :activate
4242
define :suspend_service, action: :suspend
4343
define :terminate_service, action: :terminate
44-
define :status_instance, action: :status
44+
define :status_service, action: :status
4545
define :specify_instance, action: :specify
4646
define :relate_instance_features, action: :relate_features
4747
define :unrelate_instance_features, action: :unrelate_features

lib/diffo/provider/resources/instance.ex

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,17 @@ defmodule Diffo.Provider.Instance do
176176

177177
attribute :service_state, :atom do
178178
allow_nil? false
179-
default :initial
179+
default Diffo.Provider.Service.default_service_state()
180180
public? true
181181

182-
constraints one_of: [
183-
:initial,
184-
:cancelled,
185-
:feasibilityChecked,
186-
:reserved,
187-
:active,
188-
:inactive,
189-
:suspended,
190-
:terminated
191-
]
182+
constraints one_of: Diffo.Provider.Service.service_states()
192183
end
193184

194185
attribute :service_operating_status, :atom do
195186
description "the service operating status, if this instance is a service"
196187
allow_nil? true
197188
public? true
198-
default Diffo.Provider.Service.default_service_operating_status()
189+
default nil
199190
constraints one_of: Diffo.Provider.Service.service_operating_statuses()
200191
end
201192

@@ -348,9 +339,18 @@ defmodule Diffo.Provider.Instance do
348339
update :feasibilityCheck do
349340
description "feasibilityChecks a service instance"
350341
require_atomic? false
342+
accept [:service_operating_status]
351343
validate attribute_equals(:type, :service)
352344
change transition_state(:feasibilityChecked)
353-
change set_attribute(:service_operating_status, :pending)
345+
346+
validate argument_in(:service_operating_status, [
347+
nil,
348+
:initial,
349+
:pending,
350+
:unknown,
351+
:feasible,
352+
:not_feasible
353+
])
354354
end
355355

356356
update :reserve do

lib/diffo/provider/resources/party_ref.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ defmodule Diffo.Provider.PartyRef do
130130
preparations do
131131
prepare build(
132132
load: [:party],
133-
sort: [role: :asc]
133+
sort: [role: :asc, inserted_at: :desc]
134134
)
135135
end
136136

lib/diffo/provider/resources/place_ref.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ defmodule Diffo.Provider.PlaceRef do
118118
preparations do
119119
prepare build(
120120
load: [:place],
121-
sort: [role: :asc]
121+
sort: [role: :asc, inserted_at: :desc]
122122
)
123123
end
124124

lib/diffo/provider/service.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ defmodule Diffo.Provider.Service do
2626
def service_operating_statuses() do
2727
[
2828
:pending,
29+
:feasible,
30+
:not_feasible,
2931
:configured,
3032
:starting,
3133
:running,

lib/diffo/util.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ defmodule Diffo.Util do
379379
## Examples
380380
iex> duration = Duration.new!(month: 1)
381381
iex> list = [duration: duration]
382-
iex> result = Diffo.Util.extract_suppress(list, :duration, :month, :months)
383-
iex> List.last(result)
384-
{:months, 1}
382+
iex> tl(Diffo.Util.extract_suppress(list, :duration, :month, :months))
383+
[months: 1]
384+
385385
"""
386386
def extract_suppress(list, tuple_key, map_key, new_tuple_key) when is_list(list) do
387387
tuple_value = get(list, tuple_key)

mix.exs

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
defmodule Diffo.MixProject do
2+
@moduledoc false
23
use Mix.Project
34

5+
@version "0.1.0"
6+
@name "Diffo"
7+
@description "TMF Service and Resource Manager with a difference"
8+
@github_url "https://github.com/diffo-dev/diffo"
9+
410
def project do
511
[
612
app: :diffo,
7-
version: "0.1.0",
13+
version: @version,
14+
name: @name,
15+
description: @description,
816
elixir: "~> 1.18",
917
start_permanent: Mix.env() == :prod,
18+
package: package(),
1019
deps: deps(),
1120
aliases: aliases(),
1221
elixirc_paths: elixirc_paths(Mix.env()),
13-
name: "Diffo",
1422
source_url: "https://github.com/diffo-dev/diffo/",
1523
homepage_url: "http://diffo.dev/diffo/",
16-
docs: [
17-
main: "Diffo.Provider",
18-
before_closing_body_tag: fn
19-
:html ->
20-
"""
21-
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
22-
<script>mermaid.initialize({startOnLoad: true})</script>
23-
"""
24-
25-
_ ->
26-
""
27-
end
28-
]
24+
docs: docs()
2925
]
3026
end
3127

@@ -55,10 +51,34 @@ defmodule Diffo.MixProject do
5551
end
5652
end
5753

54+
def docs do
55+
[
56+
homepage_url: @github_url,
57+
source_url: @github_url,
58+
source_ref: "v#{@version}",
59+
main: "readme",
60+
logo: "logos/diffo.jpg",
61+
extras: [
62+
"README.md": [title: "Guide"],
63+
"LICENSE.md": [title: "License"]
64+
]
65+
]
66+
end
67+
68+
defp package do
69+
[
70+
name: :diffo,
71+
licenses: ["MIT"],
72+
files: ~w(lib .formatter.exs mix.exs README* LICENSE* documentation),
73+
links: %{
74+
GitHub: @github_url
75+
}
76+
]
77+
end
78+
5879
# Run "mix help deps" to learn about dependencies.
5980
defp deps do
6081
[
61-
{:outstanding, "~> 0.2.3"},
6282
{:ash_outstanding, "~> 0.2.1"},
6383
{:ash_jason, "~> 2.0"},
6484
{:ash_state_machine, "~> 0.2.7"},

0 commit comments

Comments
 (0)