-
Notifications
You must be signed in to change notification settings - Fork 5
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
Make sure alpm_release is run at end of transaction. #8
Comments
@guinux |
It is alpm_trans_release which need to be run at the end of all transaction not alpm_release. |
Sorry for the mistake on the function names. |
np. I still need to understand transactions! |
To save you some time understanding the sources, here is how a transaction works:
|
that's brill, thanks! |
Between alpm_trans_prepare and alpm_trans_commit your can have access to the complete list of pkgs to install and remove (with deps and conflicts to remove) with alpm_trans_get_add and alpm_trans_get_remove |
I'm looking at modeling this as enum Initialized {}
enum Prepared {}
impl Transaction<Initialized> {
pub fn add(...) { ... }
pub fn remove(...) { ... }
pub fn prepare(...) -> Transaction<Prepared> { ... }
}
impl Transaction<Prepared> {
pub fn commit(...) { ... }
} These might not be the correct signatures, but hopefully you get the idea - the transaction is parameterised and different functionality is available depending on the state parameter. This is how http requests are handled in hyper (hyper http docs) |
Looks good to me :) |
I'm currently struggling with transactions. There are various times when The only solution I can see is exploit the internal structure of the transaction to get the state, but this would then be vulnerable to updates (a non-breaking change could break my code). Sadly I can't see any other way to do it, but I'll think about it and see if I have any ideas. |
What about running alpm_get_add and alpm_get_remove after running a successful alpm_trans_prepare to check if there is something to do? |
Ooh good idea! |
An implementation is now comitted. It's testable using the examples/update.rs example. |
The text was updated successfully, but these errors were encountered: