{"action":"created","issue":{"url":"https://api.github.com/repos/hooklift/node-libvirt/issues/9","labels_url":"https://api.github.com/repos/hooklift/node-libvirt/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/hooklift/node-libvirt/issues/9/comments","events_url":"https://api.github.com/repos/hooklift/node-libvirt/issues/9/events","html_url":"https://github.com/hooklift/node-libvirt/issues/9","id":4017003,"number":9,"title":"use libuv thread pool for blocking functions","user":{"login":"c4milo","id":41681,"avatar_url":"https://avatars.githubusercontent.com/u/41681?v=3","gravatar_id":"","url":"https://api.github.com/users/c4milo","html_url":"https://github.com/c4milo","followers_url":"https://api.github.com/users/c4milo/followers","following_url":"https://api.github.com/users/c4milo/following{/other_user}","gists_url":"https://api.github.com/users/c4milo/gists{/gist_id}","starred_url":"https://api.github.com/users/c4milo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c4milo/subscriptions","organizations_url":"https://api.github.com/users/c4milo/orgs","repos_url":"https://api.github.com/users/c4milo/repos","events_url":"https://api.github.com/users/c4milo/events{/privacy}","received_events_url":"https://api.github.com/users/c4milo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":37,"created_at":"2012-04-07T18:39:08Z","updated_at":"2015-04-01T02:50:55Z","closed_at":null,"body":"All the functions doing IO should use libuv's `uv_queue_work` function in order to not block Node.js main thread.\r\n\r\nSome useful references: \r\n\r\n* Libuv API: https://github.com/joyent/libuv/blob/master/include/uv.h\r\n* Libuv book section about uv_queue_work: http://nikhilm.github.io/uvbook/threads.html#libuv-work-queue"},"comment":{"url":"https://api.github.com/repos/hooklift/node-libvirt/issues/comments/88321690","html_url":"https://github.com/hooklift/node-libvirt/issues/9#issuecomment-88321690","issue_url":"https://api.github.com/repos/hooklift/node-libvirt/issues/9","id":88321690,"user":{"login":"mbroadst","id":312966,"avatar_url":"https://avatars.githubusercontent.com/u/312966?v=3","gravatar_id":"","url":"https://api.github.com/users/mbroadst","html_url":"https://github.com/mbroadst","followers_url":"https://api.github.com/users/mbroadst/followers","following_url":"https://api.github.com/users/mbroadst/following{/other_user}","gists_url":"https://api.github.com/users/mbroadst/gists{/gist_id}","starred_url":"https://api.github.com/users/mbroadst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbroadst/subscriptions","organizations_url":"https://api.github.com/users/mbroadst/orgs","repos_url":"https://api.github.com/users/mbroadst/repos","events_url":"https://api.github.com/users/mbroadst/events{/privacy}","received_events_url":"https://api.github.com/users/mbroadst/received_events","type":"User","site_admin":false},"created_at":"2015-04-01T02:50:55Z","updated_at":"2015-04-01T02:50:55Z","body":"@c4milo @atoy40 others maybe: I think it's probably time I signal my intent :smile: I've got a fork of this project that converts the entire module to work asynchronously over [here](https://github.com/mbroadst/node-libvirt/tree/the-great-refactor). I'm still trudging through the Domain class, but everything else has been converted. The branch builds on @atoy40 's work, and good lord do I understand his pain: the word \"tedious\" doesn't begin to explain this process.\r\n\r\nThere are a number of things that may or may not be appreciated/accepted, and I usually try to do things very by-the-book but I'm just very pressed for time and need this functionality ASAP:\r\n\r\n  * Things that fall into the \"need to be ironed out\"/\"people should fix it if/when it's a problem\" bucket:\r\n    * I've temporarily removed all of the Domain events because I think they should live in a better place, and generally had a rough implementation (these should be using an EventEmitter at very least, will get to it later..)\r\n\r\n    * I've removed all the static Persistent strings as they were needlessly being kept around. If you really need to keep these things defined at the top of the file (perceivably to make breaking api changes in the future I guess?) they should be #defines or const char*s.\r\n\r\n    * I have followed in the tradition of basically ignoring all flags for all virFunctions atm. This allowed me to get further more quickly, and I still think the number of approaches used in the existing codebase could use some work\r\n\r\n  * Bigger changes someone might get upset about :smile:\r\n    * I'm using c++11 explicitly so I can use std::shared_ptr. Again, I don't have time to implement this myself, and it provided a lot of flexibility when implementing the LibVirtHandle\r\n\r\n    * I've converted all of the tests to mocha+chai. I'm more used to it, async testing flows naturally with that combination for me. I've got no more excuses here.\r\n\r\n    * I completely changed the style of the C++ files. Again I have no real excuse here, other than I did in fact touch every single line of code in this project, and the style just made it easier for me to visualize huge swaths of code on my 13\" macbook screen\r\n\r\n\r\n**NOTE:** this is most decidedly a \"breaking change\", but then again I think that was in order for the module in the first place. I'm not sure whether you're even interested in the code, in which case I'm perfectly happy to leave it as fork. \r\n\r\n**Promises:** now that everything is converted to a standard node-callback format, slapping on [bluebird Promisification](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisification) is easy as pie. The tests probably look very cumbersome right now, but with promises that will all look much nicer.\r\n\r\nOK, that's it, hopefully we can get some discussion going!\r\n"}}