A struct_resolver finding a struct's schema in .dxns files on disk,
by the convention DXN.md §4.6 states for every implementation -- so one
set of schema files serves them all. Swappable like any resolver
(Dextrin.Registry.put_resolver/2): anyone with another convention
writes their own.
The convention. A name is segments joined by ., with at most one
/ between a namespace and a name (Foo.Bar/Baz); every segment is a
directory but the last, which names the file. A schema of version N
named Foo.Bar/Baz is looked for, on each search path in order, in
| layout | version 1 | version N |
|---|---|---|
| directories | Foo/Bar/Baz.dxns, Foo/Bar/Baz-v1.dxns | Foo/Bar/Baz-vN.dxns |
| a directory per name | Foo/Bar/Baz/v1.dxns | Foo/Bar/Baz/vN.dxns |
| flat | Foo.Bar.Baz.dxns, Foo.Bar.Baz-v1.dxns | Foo.Bar.Baz-vN.dxns |
| the namespace file | the entry Baz in Foo.Bar.dxns | the same, by its %schema(N) |
and a name with no / is its own namespace: Money in Money.dxns.
- The first search path that has the name at all decides.
- A file's version is its schema's:
Baz-v2.dxnsholdsBazas%schema(2), or is refused (schema/compile). - One version is found once: two files holding the same version are refused, naming both, rather than one being picked.
- Every version found is loaded, so that a struct written with an older one reaches the materializer.
Summary
Functions
A struct_resolver searching search_paths in order.
Functions
@spec for_paths([Path.t()]) :: Dextrin.Registry.struct_resolver()
A struct_resolver searching search_paths in order.