{"action":"created","issue":{"url":"https://api.github.com/repos/byzhang/leveldb/issues/47","labels_url":"https://api.github.com/repos/byzhang/leveldb/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/byzhang/leveldb/issues/47/comments","events_url":"https://api.github.com/repos/byzhang/leveldb/issues/47/events","html_url":"https://github.com/byzhang/leveldb/issues/47","id":59730095,"number":47,"title":"Seek() semantics asymmetry","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/byzhang/leveldb/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/byzhang/leveldb/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/byzhang/leveldb/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-04T00:16:30Z","updated_at":"2015-03-04T00:16:31Z","closed_at":"2015-03-04T00:16:30Z","body":"```\nAs it is possible to:\n\nSeek at first key in the source that at or past target\n\nit should be possibile to:\n\nSeek at first key in the source that at or before target\n\nThis would enable easier backward iterations.\n\nI let you judge on the two options that I see:\n\n1. adding a back option to Seek\n2. providing SeekBack method.\n\nThanks!\n```\n\nOriginal issue reported on code.google.com by `Paolo.Losi` on 19 Oct 2011 at 9:39"},"comment":{"url":"https://api.github.com/repos/byzhang/leveldb/issues/comments/77070478","html_url":"https://github.com/byzhang/leveldb/issues/47#issuecomment-77070478","issue_url":"https://api.github.com/repos/byzhang/leveldb/issues/47","id":77070478,"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-03-04T00:16:31Z","updated_at":"2015-03-04T00:16:31Z","body":"```\nIs it something wrong for this function? if iterator is invalid, all the value \nare greater than target. so, we need to SeekToLast, right?\n\n\n void SeekBack(leveldb::Iterator* iter,\n                leveldb::Comparator* comparator, \n                const leveldb::Slice& target) {\n    iter->Seek(target);\n    if (!iter->Valid()) {\n      iter->SeekToLast();\n    } else if (comparator->Compare(iter->key(), target) > 0) {\n      iter->Prev();\n    }\n  }\n```\n\nOriginal comment by `liudaok...@gmail.com` on 23 Dec 2011 at 7:40"}}