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
//! The `$MIDENUP_HOME` layout, in one place.
//!
//! Every path under `MIDENUP_HOME` is named by exactly one function here. Spelling a layout path
//! inline is how `install` and `uninstall` drifted apart: one wrote `lib/<artifact>` and the other
//! looked for `<artifact>`, and nothing connected the two.
//!
//! ```text
//! $MIDENUP_HOME/
//! |- state.json local installation state
//! |- publications/
//! | |- <channel>-<publication-id>/ immutable; named opaquely
//! | |- receipt.json
//! | |- bin/ lib/ etc/ opt/
//! |- toolchains/
//! | |- <channel> -> ../publications/<channel>-<publication-id>
//! | |- stable -> <channel>
//! | |- default -> <channel>
//! |- opt -> toolchains/<active>/opt
//! ```
use ;
use cratePublicationId;
/// Local installation state: the sole logical authority on what is installed.
/// The last upstream manifest that was successfully fetched, cached verbatim.
///
/// Consulted only when a fetch fails: an operation that needs upstream can then proceed against a
/// copy that is known to have been real, and say that it is doing so, rather than failing outright
/// because a network was briefly unavailable.
/// The directory of `toolchains/<channel>` symlinks, plus the derived `stable` and `default`.
/// The stable name for a channel: a symlink into `publications/`.
///
/// This is what every consumer -- `PATH`, `MIDEN_SYSROOT`, `%lib`, `%etc` -- refers to, which is
/// what lets the publication behind it be replaced atomically.
/// Where installed trees live.
/// Mutable, component-owned state for a channel: `%var`.
///
/// Outside the publication, and keyed by channel rather than by publication, because a publication
/// is replaced wholesale on every change. The Miden client's database lives here (`%var(data)`);
/// with `var/` inside the publication, every toolchain update destroyed it.
///
/// Install, update and republication never read, write, move or delete this. The only exception is
/// channel migration, which renames it so client data follows the toolchain.
/// Where an in-flight physical operation records its intent.
///
/// Holds at most one entry, and only while an operation is running: its presence at startup means
/// a previous one was interrupted.
/// One immutable publication.
///
/// The channel is in the name for human legibility only; the publication id is what makes it
/// unique. Nothing may parse identity back out of this path.