-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Key/value backend #624
Key/value backend #624
Conversation
Needed to faclitate multiple backends (like sqlite3/other remote database)
nixops/state/__init__.py
Outdated
raise ex | ||
|
||
switcher = { | ||
"file": lambda(url): file.StateFile(url.path), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: wrong indentation
I'm not a nixops developer, but IMHO this looks nice. |
… it in state file implementation to __db
For now it's just the underlying DB, but it resembles something that can roll back the current transaction.
Yes, just found that out myself when trying to run the tests one final time; the issue was that I invoked the tests in another way that did not trigger this :(. The commit that I pushed after your comment should fix that, I'm running the vbox tests again at the moment. |
Ok I pulled again and got further, however:
|
@grahamc that should fix it! |
Not sure:
python's import system is a gift that keeps on giving :D |
Wish: don't store in state file parameters that can be extracted from nix expressions or not used anyway: e. g. EC2 instance type, keys, |
What's the motiviation behind this motion? Is it to be able to support other backends than sqlite for the purpose of having the state stored e.g. in a networked database? |
Exactly.
|
Thanks, committed in 308ac51 |
@rbvermaa wrong issue? |
I would like to test this for AWS, what's the easiest way to get this version in my setup? |
@moretea @grahamc I got as far that I now also getting the error
Have you been able to solve this? |
fixed merge conflicts in my clone of the fork and will continue modifying the source for this patch there. |
Some explanation of the reason/point of this change would be nice. The original post provides no rationale. |
The point is that you'll be able to store state remotely eventually, instead of a local sqlite3 file. Being able to have a key/value that stores to JSON will be a first step to be able to store settings in a remote implementation of that |
@moretea are you still working on this one? |
Hi, |
See #1264 |
Hello! Thank you for this PR. In the past several months, some major changes have taken place in
This is all accumulating in to what I hope will be a NixOps 2.0 My hope is that by adding types and more thorough automated testing, However, because of the major changes, it has become likely that this If you would like to see this merge, please bring it up to date with Thank you again for the work you've done here, I am sorry to be Graham |
There are quite some ideas in the issue tracker about how we could improve nixops radically.
I would like to start out with a feasible iterative plan. As far as I can see, only very trivial SQL operations are every executed against the sqlite3 database; the main use case is to use transactions to support rollback in the case of exceptions. This should not be to hard to implement ourselves in memory, in combination with a key/value server that supports locking certain keys.
file.Statefile