aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/design.md4
-rw-r--r--nix/module.nix2
-rw-r--r--src/store.rs3
-rw-r--r--tests/migrations.rs4
4 files changed, 11 insertions, 2 deletions
diff --git a/docs/design.md b/docs/design.md
index 301659a..054b824 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -403,7 +403,9 @@ run commands, but on the provider's side, before there is a submission.)
they can be encrypted to the host's key.
- Submissions may wait in an incoming directory for the next switch
(section 6); those the switch refuses are moved aside, so the next
- switch doesn't trip over them again.
+ switch doesn't trip over them again. Names starting with a dot are
+ skipped, so that a provider can put a submission in place whole: copy
+ it under a dot name, then rename it, within the incoming directory.
- At boot and on each apply, the receptor materializes the views under
`/run` (memory): secret ones readable by root only and handed to
services as systemd credentials; public ones readable by everyone.
diff --git a/nix/module.nix b/nix/module.nix
index 10623d1..3028df5 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -278,6 +278,8 @@ in
Where submissions wait for the next switch, each a directory of its own, taken
in the order of their names: planned against the new generation's schema
before switching, which a refused one refuses, and applied by the switch.
+ Names starting with a dot are skipped: copy a submission under one, then
+ rename it, within this directory, so that it is never seen half copied.
'';
};
diff --git a/src/store.rs b/src/store.rs
index c6d4d6c..0c8f50d 100644
--- a/src/store.rs
+++ b/src/store.rs
@@ -233,7 +233,8 @@ impl Store {
}
/// Where submissions wait for the next `--migrate`, each in a directory of its own,
- /// taken in the order of their names.
+ /// taken in the order of their names. Those starting with a dot are skipped, so that
+ /// a provider can copy a submission under such a name, and rename it when whole.
pub fn incoming_dir(&self) -> PathBuf {
self.state.join("incoming")
}
diff --git a/tests/migrations.rs b/tests/migrations.rs
index e66895c..c892f72 100644
--- a/tests/migrations.rs
+++ b/tests/migrations.rs
@@ -350,6 +350,8 @@ fn incoming_submissions() {
std::fs::create_dir_all(&incoming).unwrap();
std::fs::rename(dir, incoming.join(name)).unwrap();
};
+ // Half copied, under a dot name: skipped, and left alone.
+ std::fs::create_dir_all(host.root.join("state/incoming/.half/channels")).unwrap();
// A first deployment: nothing but a waiting submission.
put("1", &rotate(&host, "first", "a", b"A"));
let check = host.migrate(&s2, true);
@@ -370,6 +372,8 @@ fn incoming_submissions() {
assert_eq!(host.view("a", "a").unwrap(), b"A");
assert!(host.snapshot("secrets").is_some());
assert!(!host.root.join("state/incoming/1").exists());
+ assert!(host.root.join("state/incoming/.half").exists());
+ assert_eq!(migration.incoming.len(), 1);
// The deploy created the state directory, readable by all; it is root's now.
use std::os::unix::fs::PermissionsExt;
let mode = std::fs::metadata(host.root.join("state"))