endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
768 stars 68 forks source link

feat(cli,daemon): Add `move` CLI command #2227

Closed rekmarks closed 2 months ago

rekmarks commented 2 months ago

Adds a command move corresponding to the daemon directory's move(), with pet name path support. Replaces the existing rename command, which had been broken for some time.

Also ensures that the directory's move() method immediately deletes the "from" name mapping. Adds a test for the same. This mapping was already removed from disk and would not persist after restarts.

kriskowal commented 2 months ago

The design space for move interacts with the representation of identifiers in the pet dæmon network. Moving should be approximately equivalnt to E(powers).locate(...toPath).write(toName, E(powers).locate(...fromPath)). We currently use identify so this operation fails to introduce the addresses of the node housing the from entity to the node housing the to hub/directory/agent.

I’m imagining that locate and write will conspire at the level of a pet-sitter to take a “pet locator” and divide its (overlapping) parts between a “pet id” and “peer locator”, submitting the “pet id” to the underlying “pet store” and submitting the “peer locator” to the node’s “peer store”. So locate would combine these components on-the-fly and write would separate them on-the-fly. I think that would allow a reference to move from one node to another robustly.