-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/ should be refactored so it's just a thin layer over actions #519
Comments
Here's a handy table I made while investigating the current state of the world:
Ideally, all of these columns should be full of "actions.{SomeMethod}", except the third column, which represents trying to access a remote dataset while not connected and necessarily should be an error, and the fourth column which should be using "Node.{SomeMethod}" to send requests to connected peers. Any cell beginning with an asterisk ("*") is currently broken behavior. |
Get method written so that it is used by both cmd/ and api/. Follows the new guideline set out by #519, moving nearly all the logic from lib/ to actions/. Logic which is specific to the command-line, selecting parts of a dataset using a path, moved up a level to the cmd/ package. Get can now be used to retrieve info about local and remote datasets, from both command-line and api server. Fixes #509, #479 #397, and possibly others. Clears the way to merging `body` into `get` in a future PR. Breaks ability to `get` multiple datasets at once.
Get method written so that it is used by both cmd/ and api/. Follows the new guideline set out by #519, moving nearly all the logic from lib/ to actions/. Logic which is specific to the command-line, selecting parts of a dataset using a path, moved up a level to the cmd/ package. Get can now be used to retrieve info about local and remote datasets, from both command-line and api server. Fixes #509, #479 #397, and possibly others. Clears the way to merging `body` into `get` in a future PR. Breaks ability to `get` multiple datasets at once.
Get method written so that it is used by both cmd/ and api/. Follows the new guideline set out by #519, moving nearly all the logic from lib/ to actions/. Logic which is specific to the command-line, selecting parts of a dataset using a path, moved up a level to the cmd/ package. Get can now be used to retrieve info about local and remote datasets, from both command-line and api server. Fixes #509, #479 #397, and possibly others. Clears the way to merging `body` into `get` in a future PR. Breaks ability to `get` multiple datasets at once.
The lib/ directory, responsible for being the entry point that both cmd/ and api/ call, should be little more than a thin layer over the functions in (repo/)actions/, dispatching calls over rpc or p2p.Node based upon whether
qri connect
is running or whether the datasetref parameter is locally available or not.The fact that this doesn't happen currently is the source of a lot of inconsistent behavior, bugs, and missing functionality. For example, many commands fail to work when
qri connect
is running, even if they need to simply access local data. Other commands fail to work on remote dataset refs even when they should. Changing each command one-by-one to fix these bugs is slow-going and error-prone; better to fix the architecture instead.Currently, commands fall into three camps:
qri get
)(that's it)
qri connect
, regardless of whether the dataset is local or notAll the following commands exhibit this behavior, caused by the fact that they call cmd/qri.go's function QriOptions.Repo(), which throws an error if
qri connect
is running:This is not a hard requirement though, these functions should instead dispatching the call through the rpc client.
Additionally, in cases where the lib/ code is calling dsfs/ functionality (List, Get, Render) instead of functions in actions/, a new action should be created to remove this direct dependency. See #183.
The text was updated successfully, but these errors were encountered: