{"action":"created","issue":{"url":"https://api.github.com/repos/kisielk/og-rek/issues/38","repository_url":"https://api.github.com/repos/kisielk/og-rek","labels_url":"https://api.github.com/repos/kisielk/og-rek/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/kisielk/og-rek/issues/38/comments","events_url":"https://api.github.com/repos/kisielk/og-rek/issues/38/events","html_url":"https://github.com/kisielk/og-rek/pull/38","id":341826655,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxODY5MzM1","number":38,"title":"Allow to hook-in application-level logic to handle persistent references","user":{"login":"navytux","id":1794248,"node_id":"MDQ6VXNlcjE3OTQyNDg=","avatar_url":"https://avatars1.githubusercontent.com/u/1794248?v=4","gravatar_id":"","url":"https://api.github.com/users/navytux","html_url":"https://github.com/navytux","followers_url":"https://api.github.com/users/navytux/followers","following_url":"https://api.github.com/users/navytux/following{/other_user}","gists_url":"https://api.github.com/users/navytux/gists{/gist_id}","starred_url":"https://api.github.com/users/navytux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navytux/subscriptions","organizations_url":"https://api.github.com/users/navytux/orgs","repos_url":"https://api.github.com/users/navytux/repos","events_url":"https://api.github.com/users/navytux/events{/privacy}","received_events_url":"https://api.github.com/users/navytux/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-07-17T08:58:01Z","updated_at":"2018-07-17T16:54:15Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/kisielk/og-rek/pulls/38","html_url":"https://github.com/kisielk/og-rek/pull/38","diff_url":"https://github.com/kisielk/og-rek/pull/38.diff","patch_url":"https://github.com/kisielk/og-rek/pull/38.patch"},"body":"Continuing 84598fe1 (Add support for persistent references) theme let's\r\ndevelop support for persistent references more: the usual situation (at\r\nleast in ZODB context, which is actually the original reason\r\npersistent references exist) is that decode converts a reference of\r\n(type, oid) tuple form into corresponding \"ghost\" object - an instance\r\nof type, but not yet loaded with database object's data. This way\r\nresulted object tree is created right away with types application\r\nexpects (and ZODB/py further cares to automatically load object data\r\nwhen that ghost objects are accessed).\r\n\r\nTo mimic this on Go side, with current state, after decoding, one would\r\nneed to make a full reflect pass on the resulted decoded objects, find\r\nRefs, and convert them to instances of other types, also caring to\r\npatch pointers in other objects consistently that were pointing to such\r\nRefs. In other words it is some work and it coincides almost 100% with\r\nwhat Decoder already does by itself.\r\n\r\nThus, not to duplicate that work and conducting parallel with Python\r\nworld, let's add ability to configure Decoder and Encoder so that\r\npersistent references could be handled with user-specified application\r\nlogic right in the process, and e.g. Decoder would return resulted\r\nobject with references converted to corresponding Go types.\r\n\r\nTo do so we introduce DecoderConfig and EncoderConfig - configurations\r\nto tune decode/encode process. To maintain backward compatibility\r\nNewDecoder and NewEncoder signatures are not adjusted and instead\r\nNewDecoderWithConfig and NewEncoderWithConfig are introduces. We should\r\nbe sure we won't need e.g. NewDecoderWithConfigAndXXX in the future,\r\nsince from now on we could be adding fields to configuration structs\r\nwithout breaking backward compatibility.\r\n\r\nFor decoding there is DecoderConfig.PersistentLoad which mimics\r\nUnpickler.persistent_load in Python:\r\n\r\nhttps://docs.python.org/3/library/pickle.html#pickle.Unpickler.persistent_load\r\n\r\nFor encoding there is EncoderConfig.PersistentID which mimics\r\nPickler.persistent_id in Python:\r\n\r\nhttps://docs.python.org/3/library/pickle.html#pickle.Pickler.persistent_id\r\n\r\nThen both Decoder and Encoder are adjusted correspondingly with tests\r\nadded.\r\n\r\nAbout tests: I was contemplating to patch-in support for decoder and\r\nencoder configurations, and handling errors, into our main test\r\nTestDecode, but for now decided not to go that way and to put the test\r\nas separate TestPersistentRefs.\r\n\r\nBy the way, with having configurations in place, we could start to add\r\nother things there - e.g. the protocol version to use for Encoder.\r\nCurrently we have several places where we either don't use opcodes from\r\nhigher protocol versions (fearing to break compatibility), or instead\r\nalways use higher-version opcodes without checking we should be able to\r\ndo so by allowed protocol version."},"comment":{"url":"https://api.github.com/repos/kisielk/og-rek/issues/comments/405652138","html_url":"https://github.com/kisielk/og-rek/pull/38#issuecomment-405652138","issue_url":"https://api.github.com/repos/kisielk/og-rek/issues/38","id":405652138,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTY1MjEzOA==","user":{"login":"kisielk","id":58618,"node_id":"MDQ6VXNlcjU4NjE4","avatar_url":"https://avatars2.githubusercontent.com/u/58618?v=4","gravatar_id":"","url":"https://api.github.com/users/kisielk","html_url":"https://github.com/kisielk","followers_url":"https://api.github.com/users/kisielk/followers","following_url":"https://api.github.com/users/kisielk/following{/other_user}","gists_url":"https://api.github.com/users/kisielk/gists{/gist_id}","starred_url":"https://api.github.com/users/kisielk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kisielk/subscriptions","organizations_url":"https://api.github.com/users/kisielk/orgs","repos_url":"https://api.github.com/users/kisielk/repos","events_url":"https://api.github.com/users/kisielk/events{/privacy}","received_events_url":"https://api.github.com/users/kisielk/received_events","type":"User","site_admin":false},"created_at":"2018-07-17T16:54:15Z","updated_at":"2018-07-17T16:54:15Z","author_association":"OWNER","body":"In github you just add more commits to your branch, instead of squashing, then you can view the diff between each commit. I think you can then also click done on the requested changes. It's quite different from gerrit workflow."}}
{"actor":{"display_login":"kisielk"}}