-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dispatch): Abs paths on inputs to dispatch methods
Background: when `qri connect` is running, it holds an exclusive lock, and other invocations of qri will send their commands to that connected process using RPC. The two processes may be running in different directories, so it is necessary to change file paths to be absolute before sending the params across RPC. Before, we would do this explicitly, which was error-prone and easy to forget about, since the broken behavior would not happen in the common case. The proposed solution implemented here adds tags to structs that are passed to methods. Most use `qri:"fspath"` to specify fields that are file system paths. Diff is special and uses `qri:"dsrefOrFspath"` because its inputs can be either dsrefs or file paths. Adding this behavior for new commands is simple; it just requires adding this tag. An alternative would be to add a type for qfs.FilePath that does this behavior itself. However, that requires users of qri to know about this type, and FilePath types are typically quite tricky to fully implement. This solution is simpler and adds less maintenance vs creating our own path type, though it is admittedly a bit magical. Personally, I don't think it's that bad, as it matches the standard use case of tags for serialization, if we view fully absolute paths being sent over RPC as a type of data marshalling. Plus, the Diff inputs act quite special. Simply creating a qfs.FilePath would not be sufficient to handle Diff's parameters, and fixing Diff in some way would probably add more complication than its worth.
- Loading branch information
Showing
7 changed files
with
63 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters