{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/hollow/issues/181","repository_url":"https://api.github.com/repos/Netflix/hollow","labels_url":"https://api.github.com/repos/Netflix/hollow/issues/181/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/hollow/issues/181/comments","events_url":"https://api.github.com/repos/Netflix/hollow/issues/181/events","html_url":"https://github.com/Netflix/hollow/pull/181","id":302006882,"number":181,"title":"HollowIncrementalProducer - added restoreFromLastState [proposal]","user":{"login":"rpalcolea","id":1625920,"avatar_url":"https://avatars2.githubusercontent.com/u/1625920?v=4","gravatar_id":"","url":"https://api.github.com/users/rpalcolea","html_url":"https://github.com/rpalcolea","followers_url":"https://api.github.com/users/rpalcolea/followers","following_url":"https://api.github.com/users/rpalcolea/following{/other_user}","gists_url":"https://api.github.com/users/rpalcolea/gists{/gist_id}","starred_url":"https://api.github.com/users/rpalcolea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpalcolea/subscriptions","organizations_url":"https://api.github.com/users/rpalcolea/orgs","repos_url":"https://api.github.com/users/rpalcolea/repos","events_url":"https://api.github.com/users/rpalcolea/events{/privacy}","received_events_url":"https://api.github.com/users/rpalcolea/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-03T15:30:08Z","updated_at":"2018-03-09T22:19:17Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/Netflix/hollow/pulls/181","html_url":"https://github.com/Netflix/hollow/pull/181","diff_url":"https://github.com/Netflix/hollow/pull/181.diff","patch_url":"https://github.com/Netflix/hollow/pull/181.patch"},"body":"This pull request:\r\n\r\n* Introduces Builder pattern for `HollowIncrementalProducer`\r\n* Users could provide `AnnouncementWatcher, BlobRetriever and data model`\r\n* Users can now restore from last state using the `HollowIncrementalProducer.restoreFromLastState)`.\r\n* Kept public constructors: these could be removed later. I know `HollowIncrementalProducer` is a BETA API but for now I think it makes sense to keep them and perhaps deprecate in Hollow 3?\r\n\r\nWith the introduction of https://github.com/Netflix/hollow/pull/178 and this, users could now write the first cycle using the incremental directly and restore from previous states. This would significantly reduce their code by avoiding all that logic that basically everyone would have to write in order to restore an incremental producer.\r\n\r\nIn the future `HollowIncrementalProducer` could be just another type of `HollowProducer` but that's not in the scope of this pull request."},"comment":{"url":"https://api.github.com/repos/Netflix/hollow/issues/comments/371961471","html_url":"https://github.com/Netflix/hollow/pull/181#issuecomment-371961471","issue_url":"https://api.github.com/repos/Netflix/hollow/issues/181","id":371961471,"user":{"login":"duro1","id":15158605,"avatar_url":"https://avatars3.githubusercontent.com/u/15158605?v=4","gravatar_id":"","url":"https://api.github.com/users/duro1","html_url":"https://github.com/duro1","followers_url":"https://api.github.com/users/duro1/followers","following_url":"https://api.github.com/users/duro1/following{/other_user}","gists_url":"https://api.github.com/users/duro1/gists{/gist_id}","starred_url":"https://api.github.com/users/duro1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duro1/subscriptions","organizations_url":"https://api.github.com/users/duro1/orgs","repos_url":"https://api.github.com/users/duro1/repos","events_url":"https://api.github.com/users/duro1/events{/privacy}","received_events_url":"https://api.github.com/users/duro1/received_events","type":"User","site_admin":false},"created_at":"2018-03-09T22:19:17Z","updated_at":"2018-03-09T22:19:17Z","author_association":"CONTRIBUTOR","body":"@rpalcolea This looks good.  It currently is a little involved to know how and in what order to initialize the classic producer in order to properly use the incremental producer.\r\nWhat if instead of a builder, the newly proposed constructor arguments were mandatory, in the next major release?\r\n\r\nThis would allow the client to call the restoreFromLastState at any point, but know that the necessary objects should be present. This would also allow for controls to be added around running the first cycle only after restoring (or verifying a previous does not exist)\r\n\r\ne.g.\r\nprivate boolean isInitialized;\r\n\r\n    restoreFromLastState(...)\r\n        (attempt restore)\r\n        isInitialized=true;\r\n\r\n    public long runCycle() {\r\n        if(!isInitialized)\r\n            throw new IllegalStateException(\"You must restore state prior running an IncrementalProducer cycle\");\r\n        ...\r\n"}}
{"actor":{"display_login":"duro1"}}