{"action":"created","issue":{"url":"https://api.github.com/repos/chrsmithdemos/leveldb/issues/70","labels_url":"https://api.github.com/repos/chrsmithdemos/leveldb/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/chrsmithdemos/leveldb/issues/70/comments","events_url":"https://api.github.com/repos/chrsmithdemos/leveldb/issues/70/events","html_url":"https://github.com/chrsmithdemos/leveldb/issues/70","id":58997501,"number":70,"title":"Provide \"close\" interface to leveldb","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chrsmithdemos/leveldb/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/chrsmithdemos/leveldb/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/chrsmithdemos/leveldb/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-26T00:41:54Z","updated_at":"2015-02-26T00:41:55Z","closed_at":"2015-02-26T00:41:55Z","body":"```\nAccording to the API document, for Closing A Database, just delete the database \nobject. Example:\n\n  ... open the db as described above ...\n  ... do something with db ...\n  delete db;\n\n\nIt might leads to some encapsulation error. For example, if there were a \nstorage encapsuator with \"clear\" interface as well as iterator interface, and \nwithin the implementation of \"clear\":\n\nvoid clear()\n{\n    delete pLeveldb_;\n}\n\nIf \"clear\" interface is called before iterator has been destroyed, it will be \neasy to lead to corruption since the leveldb instance contained by the iterator \nhas been obsolete.\n\n\n\n```\n\n-----\nOriginal issue reported on code.google.com by `yingfeng.zhang` on 3 Feb 2012 at 1:25"},"comment":{"url":"https://api.github.com/repos/chrsmithdemos/leveldb/issues/comments/76099332","html_url":"https://github.com/chrsmithdemos/leveldb/issues/70#issuecomment-76099332","issue_url":"https://api.github.com/repos/chrsmithdemos/leveldb/issues/70","id":76099332,"user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T00:41:55Z","updated_at":"2015-02-26T00:41:55Z","body":"```\nSorry, but I don't see enough benefit here to offset the extra\ncomplexity in the interface.\n\nYou can achieve something like this on your own in your encapsulation layer\nif you really have to work so hard at preventing programmer errors.\n\nE.g., make two fields:\n   DB* pLeveldb_;\n   DB* pPendingDeletion_;\nBoth point to the same DB.\nWhen clearing, just set pLeveldb_ to NULL.\nAnd \"delete pPendingDeletion_\" when your code determines it is\nsafe to do so.\n\n```\n\n-----\nOriginal comment by `san...@google.com` on 3 Feb 2012 at 4:35\n* Changed state: **WontFix**"}}