-
Notifications
You must be signed in to change notification settings - Fork 133
Implement a consistent state #36
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
Conversation
1 similar comment
I also have to update the readme, after we agree that this implementation is OK. |
Have some feedback but first: what's this solving? What's the intended use vs. current API? |
tl;dr; This is not solving anything, it's simplifying and preparing for other features that would be hard to do if this PR wouldn't exist.
|
I very much think the risks of this PR are mininal, if we don't consider the breaking changes. |
If I understand correctly, that's the goal? If so, then what's the use case look like? I.e. how do you envision this being used? I imagine you want the caller to be notified when the cmd starts and stops (for any reason, i.e. successful or not)? Yes re "don't fix it if it's not broken". Also, I think it's beneficial to work backwards from the user experience to the tech which is why I'm more curious about the former than the latter at this point. Another philosophy: avoiding feature creep. This seems like a good feature. I want to keep it as minimally implemented as possible so it's less to test, document, and support. |
Also looks like you want a full push model rather than a mixed push and pull/poll model wrt cmd status? With current API, there's one push: the final |
So the goal of this PR is only to simplify the state from many variables to only 1 and to funnel the state changes into a single function. Inside this function I will emit events on each state change, but this will happen in another PR.
Do you have any specific sugestions? In my point of view, this is the smallest it can get.
Inside the new
I don't think we need to change the Start() function (again, that's for the next PR). The state change could be in a separate function called "Watch" and should be optional. But again, maybe it's better to move the discussion of the state watching in the next PR, when I actually write the code for that, just to keep this discussion easier. |
I realize that we could implement this PR without breaking the compatibility of the Status struct. We can keep the Not sure, is this a hard requirement? To maintain backward compatibility? |
Closing due to merge conflicts and inactivity. I'm not sure this is the right direction for this pkg. It's a fair bit of additional logic (i.e. states); I'd rather keep the pkg very simple: just start, status, and stop a command. I think a change like this might warrant a fork. In any case, thank you for your work! |
This PR implements a consistent state for Cmd.
Human readable description of the changes:
State
(is it a good idea to make the State a public variable ?)Complete
variable from "Status" struct (is it a good idea to include the State instead ? In case it's a private variable, it would make sense)setState
and publicIsInitialState
andIsFinalState
because they are relevant to be public.