endojs / endo

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

cli: Support dot-delimited petname paths #2023

Open rekmarks opened 7 months ago

rekmarks commented 7 months ago

Following #2022, we should support dot-delimited petname paths in the CLI such that wherever a petname for an existing value is provided, a path can be provided instead. This path will then be passed to the mailbox lookup method, which will attempt to resolve the value.

For example, this should work:

$ endo eval '10' --name ten
10
$ endo eval 'foo' foo:INFO.ten.source
10

Note that the parsePetNamePath() utility should be used for dot-delimited path parsing in the CLI.

See also discussion in #1915.

TODO

N/A

kriskowal commented 7 months ago

endo rename should be replaced with endo mv|move when we can support dot delimited paths, and we should support dot delimited paths for both the source and target. We should also guarantee that a move occurs in a single JavaScript event unless the dot-delimited path reaches outside the local dæmon. That will require the move operation to walk from formula to formula for both the source and target path before falling through to the lookup protocol. We will need a corresponding protocol for “depositing” a formula identifier to the target “directory” and allow that protocol to work remotely.

E(remoteDirectory).deposit(name, nonce, addresses). See https://github.com/ocapn/ocapn/pull/105

The local behavior occurs if the nonce exists in the daemon and just writes the corresponding name and formula identifier to the local pet store (directory). Otherwise, the remote behavior is to create a “remote” formula that captures the nonce and addresses. So, if the remote restarts, it can reestablish a connection to the node that the nonce calls home.