Skip to main content

Module agent_move

Module agent_move 

Source
Expand description

Agents move (POST /api/v1/agent/move): one agent moved to another computer on the LAN, in one step (SPEC_MOVE_AN_AGENT_TO_ANOTHER_COMPUTER sections 5 and 6, step D of the build). This is the source’s side; the destination’s operations are remote_ops::move_ops.

In order: preflight (the destination answers, signed by its install key for this asker and this nonce, with the box key the move’s content key is sealed to); hand over (the agent is stopped and marked, and its archive written, by the same export Agents export makes); offer (signed by this install: the person at the destination decides, and dry_run stops before any of this); transfer (256 KiB sealed chunks, the destination’s bitmap says which are missing); commit (the destination registers the agent last and answers registered). Only after that answer is the agent marked moved here. A move that stops anywhere before it leaves the agent handed_over: resume continues it as a new attempt, bring_back returns it. Who may ask is who may export with a hand-over: the agent’s leader, never the agent itself.

Structs§

Destination 🔒
What the destination said about itself, checked.
Journal 🔒
What a move that stopped keeps, so resume continues it: the archive that was written and the move’s name.
MoveClaim 🔒
MoveRequest 🔒
Tell 🔒
What telling the peers needs.

Enums§

Begun 🔒
What starting a move comes to: the agent was already placed there and the move is finished, or the move goes on with this journal (and whether it is a resumed one).
Wait 🔒
Why the wait for the person’s decision ended without it: they (or the clock) said no, so the agent is returned; or the destination could not be reached, so the move is kept to be resumed.

Constants§

AUDIT_ACTION 🔒
CHUNK_TRIES 🔒
Tries for one chunk before the move stops (and can be resumed).
CONSENT_WAIT 🔒
How long the person at the destination has to decide (the countdown is 30 s, doubled with no super agent there).
POLL 🔒
POLL_TRIES 🔒
Questions in a row that may fail while waiting for the person’s decision.
STD 🔒

Functions§

audit 🔒
await_consent 🔒
The consent the person at the destination gives, or why not. Polled: the destination answers at once and the countdown runs there.
begin 🔒
The agent is handed over (stopped, marked, written to a file) for a first move, or the kept move is taken up again for a resume.
chunk_count 🔒
contents_of 🔒
declined 🔒
The destination refused, or nobody decided: the agent that was handed over for it is returned.
destination_key 🔒
The destination install’s public key, proved by a certificate one of its agents holds: the chain must verify and the install id the certificate names must be the one the peer advertises (an id is derived from its key).
done 🔒
The answer of an operation that was done, or why it was not.
finish 🔒
The destination registered the agent: it is marked moved here, and the file and the journal are removed.
handle_agent_move 🔒
internal 🔒
journal_path 🔒
move_agent 🔒
move_in_flight 🔒
Whether a move of uid is running here now.
moving 🔒
The agents being moved from here now. One move of an agent at a time, from its hand-over to its answer: a second move or resume, or a bring_back, of an agent in this set is refused, so the agent never has two lives and two attempts never race.
my_install 🔒
This install’s keys.
offer_to 🔒
Sends the offer, after the source’s row for it: who asked, what is offered, to which computer. A row says sizes and counts, never content. An offer the destination refuses is a refused row too, with its reason, so the trail does not end at offered.
preflight 🔒
read_full 🔒
read_journal 🔒
refused_row 🔒
The refused row of an offer the destination did not take, with its reason; nothing for any other answer.
release_kept_move 🔒
Before bring_back clears the mark of an agent whose move stopped: the destination is asked to end that move, because it may have registered the agent with only its answer lost, and the agent would then live in both places. The agent comes back only when the destination says the move is ended (it holds nothing of it any more) or when force says it is not there; a destination that cannot be reached, or that already placed the agent, keeps it handed over. The kept archive is removed.
run 🔒
stopped_row 🔒
A step of the move stopped it (the destination could not be reached, or an answer was not the one a step needs): the move’s trail ends with a stopped row saying why, under the move id, and the agent stays handed over so the move can be resumed.
tell_peers 🔒
The statement that the name moved, signed by this install and sent to every other computer on the LAN: the ones that pinned the name under this install move their pin when the new key shows up, and the others refuse it as they do not hold the name. Best effort: a computer not reached falls back to accepting the key by hand. How many accepted it.
transfer 🔒
Sends every chunk the destination is missing, one at a time, each tried a few times.
unreachable 🔒
write_journal 🔒