{"action":"created","comment":{"url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/comments/41095323","id":41095323,"diff_hunk":"@@ -0,0 +1,162 @@\n+//\n+//  OriginateMutableRemoteCollection.m\n+//  OriginateRemoteCollection-Example","path":"Pod/Sources/OriginateMutableRemoteCollection.m","position":3,"original_position":3,"commit_id":"9988a3ecb1fc2fe61522b191bc1e5545f92c420d","original_commit_id":"9988a3ecb1fc2fe61522b191bc1e5545f92c420d","user":{"login":"allewun","id":1256911,"avatar_url":"https://avatars.githubusercontent.com/u/1256911?v=3","gravatar_id":"","url":"https://api.github.com/users/allewun","html_url":"https://github.com/allewun","followers_url":"https://api.github.com/users/allewun/followers","following_url":"https://api.github.com/users/allewun/following{/other_user}","gists_url":"https://api.github.com/users/allewun/gists{/gist_id}","starred_url":"https://api.github.com/users/allewun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allewun/subscriptions","organizations_url":"https://api.github.com/users/allewun/orgs","repos_url":"https://api.github.com/users/allewun/repos","events_url":"https://api.github.com/users/allewun/events{/privacy}","received_events_url":"https://api.github.com/users/allewun/received_events","type":"User","site_admin":false},"body":"remove `-Example`","created_at":"2015-10-04T07:11:39Z","updated_at":"2015-10-04T07:11:39Z","html_url":"https://github.com/Originate/OriginateAsyncCollection/pull/2#discussion_r41095323","pull_request_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/comments/41095323"},"html":{"href":"https://github.com/Originate/OriginateAsyncCollection/pull/2#discussion_r41095323"},"pull_request":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2","id":46717079,"html_url":"https://github.com/Originate/OriginateAsyncCollection/pull/2","diff_url":"https://github.com/Originate/OriginateAsyncCollection/pull/2.diff","patch_url":"https://github.com/Originate/OriginateAsyncCollection/pull/2.patch","issue_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/2","number":2,"state":"open","locked":false,"title":"Version 2.0 - Say hello to 'OriginateRemoteCollection'","user":{"login":"pkluz","id":1275218,"avatar_url":"https://avatars.githubusercontent.com/u/1275218?v=3","gravatar_id":"","url":"https://api.github.com/users/pkluz","html_url":"https://github.com/pkluz","followers_url":"https://api.github.com/users/pkluz/followers","following_url":"https://api.github.com/users/pkluz/following{/other_user}","gists_url":"https://api.github.com/users/pkluz/gists{/gist_id}","starred_url":"https://api.github.com/users/pkluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkluz/subscriptions","organizations_url":"https://api.github.com/users/pkluz/orgs","repos_url":"https://api.github.com/users/pkluz/repos","events_url":"https://api.github.com/users/pkluz/events{/privacy}","received_events_url":"https://api.github.com/users/pkluz/received_events","type":"User","site_admin":false},"body":"@allewun So - I spent some time extending this and rewrote it basically. I do honestly believe it's -much- better now. It's also to some extent simpler because I derive more of the state and got rid the many transitions.\r\n\r\nI basically re-invented distributed/remote objects on a _much_ smaller scale that could prove really useful.\r\n\r\n`OriginateRemoteCollection` now has a subclass `OriginateMutableRemoteCollection` which allows for interaction / mutation as in addition and removal of elements. It is implemented in an optimistic fashion so it applies the changes and reverts later if necessary. Currently the reverting is done naïvely, so I don't care about preserving order - only element presence is accounted for.\r\n\r\nWhat this allows for is instant UI feedback (by adding and removing elements from tables immediately(!) for instance) and doing the actual work \"later\" (and failing gracefully by rolling back if necessary).\r\n\r\nState transitions still exist but are wrapped behind the scenes, as such I'm only exposing these three functions:\r\n\r\n```objective-c\r\n- (void)load:(OriginateRemoteCollectionLoadHandler)loadHandler;\r\n- (void)addObjects:(NSArray *)objects handler:(OriginateMutableRemoteCollectionMutationHandler)addHandler;\r\n- (void)removeObjects:(NSArray *)objects handler:(OriginateMutableRemoteCollectionMutationHandler)removeHandler;\r\n```\r\n\r\nThe three blocks that are passed are the tricky part. They are blocks that take blocks as arguments. This was needed because we need to externally supply the `handler` for loading/removing/adding data and we need a way to inform the collection about the `handler` having completed its job.\r\n\r\nThe core idea remains the same, use the object as a really fancy backing store for `UITableViewDataSource` instead of dumb `NSArrays`.\r\n\r\nNow, my brain hurts. I'm going to bed.","created_at":"2015-10-04T01:32:53Z","updated_at":"2015-10-04T07:11:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c1a1a07c27e6308d8423b10a7e46ad08b74820c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2/commits","review_comments_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2/comments","review_comment_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/2/comments","statuses_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/statuses/9988a3ecb1fc2fe61522b191bc1e5545f92c420d","head":{"label":"Originate:pk-refactor","ref":"pk-refactor","sha":"9988a3ecb1fc2fe61522b191bc1e5545f92c420d","user":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"repo":{"id":43462686,"name":"OriginateAsyncCollection","full_name":"Originate/OriginateAsyncCollection","owner":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Originate/OriginateAsyncCollection","description":"A (high level) class modeling an asynchronously retrieved collection of data.","fork":false,"url":"https://api.github.com/repos/Originate/OriginateAsyncCollection","forks_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/forks","keys_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/teams","hooks_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/hooks","issue_events_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/events{/number}","events_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/events","assignees_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/assignees{/user}","branches_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/branches{/branch}","tags_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/tags","blobs_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/refs{/sha}","trees_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/statuses/{sha}","languages_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/languages","stargazers_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/stargazers","contributors_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/contributors","subscribers_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/subscribers","subscription_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/subscription","commits_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/commits{/sha}","git_commits_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/commits{/sha}","comments_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/comments{/number}","issue_comment_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/comments{/number}","contents_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/contents/{+path}","compare_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/merges","archive_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/downloads","issues_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues{/number}","pulls_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls{/number}","milestones_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/milestones{/number}","notifications_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/labels{/name}","releases_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/releases{/id}","created_at":"2015-09-30T22:19:23Z","updated_at":"2015-10-01T19:06:35Z","pushed_at":"2015-10-04T01:38:54Z","git_url":"git://github.com/Originate/OriginateAsyncCollection.git","ssh_url":"git@github.com:Originate/OriginateAsyncCollection.git","clone_url":"https://github.com/Originate/OriginateAsyncCollection.git","svn_url":"https://github.com/Originate/OriginateAsyncCollection","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Originate:master","ref":"master","sha":"a6dfff261ccac48b1c68bb8b454ecad104e208fb","user":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"repo":{"id":43462686,"name":"OriginateAsyncCollection","full_name":"Originate/OriginateAsyncCollection","owner":{"login":"Originate","id":1627168,"avatar_url":"https://avatars.githubusercontent.com/u/1627168?v=3","gravatar_id":"","url":"https://api.github.com/users/Originate","html_url":"https://github.com/Originate","followers_url":"https://api.github.com/users/Originate/followers","following_url":"https://api.github.com/users/Originate/following{/other_user}","gists_url":"https://api.github.com/users/Originate/gists{/gist_id}","starred_url":"https://api.github.com/users/Originate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Originate/subscriptions","organizations_url":"https://api.github.com/users/Originate/orgs","repos_url":"https://api.github.com/users/Originate/repos","events_url":"https://api.github.com/users/Originate/events{/privacy}","received_events_url":"https://api.github.com/users/Originate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Originate/OriginateAsyncCollection","description":"A (high level) class modeling an asynchronously retrieved collection of data.","fork":false,"url":"https://api.github.com/repos/Originate/OriginateAsyncCollection","forks_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/forks","keys_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/teams","hooks_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/hooks","issue_events_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/events{/number}","events_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/events","assignees_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/assignees{/user}","branches_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/branches{/branch}","tags_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/tags","blobs_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/refs{/sha}","trees_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/statuses/{sha}","languages_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/languages","stargazers_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/stargazers","contributors_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/contributors","subscribers_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/subscribers","subscription_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/subscription","commits_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/commits{/sha}","git_commits_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/git/commits{/sha}","comments_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/comments{/number}","issue_comment_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/comments{/number}","contents_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/contents/{+path}","compare_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/merges","archive_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/downloads","issues_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues{/number}","pulls_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls{/number}","milestones_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/milestones{/number}","notifications_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/labels{/name}","releases_url":"https://api.github.com/repos/Originate/OriginateAsyncCollection/releases{/id}","created_at":"2015-09-30T22:19:23Z","updated_at":"2015-10-01T19:06:35Z","pushed_at":"2015-10-04T01:38:54Z","git_url":"git://github.com/Originate/OriginateAsyncCollection.git","ssh_url":"git@github.com:Originate/OriginateAsyncCollection.git","clone_url":"https://github.com/Originate/OriginateAsyncCollection.git","svn_url":"https://github.com/Originate/OriginateAsyncCollection","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2"},"html":{"href":"https://github.com/Originate/OriginateAsyncCollection/pull/2"},"issue":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/2"},"comments":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/Originate/OriginateAsyncCollection/statuses/9988a3ecb1fc2fe61522b191bc1e5545f92c420d"}}}}