{"action":"created","comment":{"url":"https://api.github.com/repos/NetSys/quilt/pulls/comments/67752557","id":67752557,"diff_hunk":"@@ -0,0 +1,175 @@\n+package main\n+\n+import (\n+\t\"fmt\"\n+\t\"github.com/NetSys/quilt/dsl\"\n+)\n+\n+// a set of containers which can be placed together on a VM\n+type availabilitySet map[string]struct{}\n+\n+func (avSet availabilitySet) nodes() []string {\n+\tlabels := make([]string, 0, len(avSet))\n+\tfor l := range avSet {\n+\t\tlabels = append(labels, l)\n+\t}\n+\treturn labels\n+}\n+\n+func (avSet availabilitySet) str() string {\n+\treturn fmt.Sprint(avSet.nodes())\n+}\n+\n+func (avSet availabilitySet) check(label string) bool {\n+\t_, ok := avSet[label]\n+\tif !ok {\n+\t\treturn false\n+\t}\n+\treturn true\n+}\n+\n+func (avSet availabilitySet) copyAvSet() availabilitySet {\n+\tnewAvSet := map[string]struct{}{}\n+\tfor label := range avSet {\n+\t\tnewAvSet[label] = struct{}{}\n+\t}\n+\treturn newAvSet\n+}\n+\n+func (avSet *availabilitySet) insert(labels ...string) {\n+\tfor _, label := range labels {\n+\t\t(*avSet)[label] = struct{}{}\n+\t}\n+}\n+\n+func (avSet *availabilitySet) remove(labels ...string) {\n+\tfor _, label := range labels {\n+\t\tdelete(*avSet, label)\n+\t}\n+}\n+\n+func (avSet *availabilitySet) removeAndCheck(labels ...string) []string {\n+\tvar toMove []string\n+\tfor _, label := range labels {\n+\t\tif there := avSet.check(label); there {","path":"inspect/placement.go","position":54,"original_position":54,"commit_id":"5107a164e3a636cbc5991c65984f0d45b02b66aa","original_commit_id":"5107a164e3a636cbc5991c65984f0d45b02b66aa","user":{"login":"ZhongtianWang","id":4529189,"avatar_url":"https://avatars.githubusercontent.com/u/4529189?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhongtianWang","html_url":"https://github.com/ZhongtianWang","followers_url":"https://api.github.com/users/ZhongtianWang/followers","following_url":"https://api.github.com/users/ZhongtianWang/following{/other_user}","gists_url":"https://api.github.com/users/ZhongtianWang/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhongtianWang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhongtianWang/subscriptions","organizations_url":"https://api.github.com/users/ZhongtianWang/orgs","repos_url":"https://api.github.com/users/ZhongtianWang/repos","events_url":"https://api.github.com/users/ZhongtianWang/events{/privacy}","received_events_url":"https://api.github.com/users/ZhongtianWang/received_events","type":"User","site_admin":false},"body":"`check()` is already returning bool, so we can just use `if avSet.check(label) {`","created_at":"2016-06-20T19:39:18Z","updated_at":"2016-06-20T19:39:18Z","html_url":"https://github.com/NetSys/quilt/pull/433#discussion_r67752557","pull_request_url":"https://api.github.com/repos/NetSys/quilt/pulls/433","_links":{"self":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/comments/67752557"},"html":{"href":"https://github.com/NetSys/quilt/pull/433#discussion_r67752557"},"pull_request":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/433"}}},"pull_request":{"url":"https://api.github.com/repos/NetSys/quilt/pulls/433","id":72922896,"html_url":"https://github.com/NetSys/quilt/pull/433","diff_url":"https://github.com/NetSys/quilt/pull/433.diff","patch_url":"https://github.com/NetSys/quilt/pull/433.patch","issue_url":"https://api.github.com/repos/NetSys/quilt/issues/433","number":433,"state":"open","locked":false,"title":"inspect: Make assertions about reachability, incorporate container pl…","user":{"login":"akshayknarayan","id":3051943,"avatar_url":"https://avatars.githubusercontent.com/u/3051943?v=3","gravatar_id":"","url":"https://api.github.com/users/akshayknarayan","html_url":"https://github.com/akshayknarayan","followers_url":"https://api.github.com/users/akshayknarayan/followers","following_url":"https://api.github.com/users/akshayknarayan/following{/other_user}","gists_url":"https://api.github.com/users/akshayknarayan/gists{/gist_id}","starred_url":"https://api.github.com/users/akshayknarayan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshayknarayan/subscriptions","organizations_url":"https://api.github.com/users/akshayknarayan/orgs","repos_url":"https://api.github.com/users/akshayknarayan/repos","events_url":"https://api.github.com/users/akshayknarayan/events{/privacy}","received_events_url":"https://api.github.com/users/akshayknarayan/received_events","type":"User","site_admin":false},"body":"…acement constraints\r\n\r\n- de-capitalize types and funcs\r\n- add way to define invariants on the quilt container graph\r\n- add way to query inspect for whether invariants will hold given changes in the container graph\r\n- basic algorithm to place containers on \"availability sets\" (machines, regions, or providers) and display placement in visualization","created_at":"2016-06-07T18:17:00Z","updated_at":"2016-06-20T19:39:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71c0d47380d62302cb8d0592d82cbc6d79f47e81","assignee":{"login":"ZhongtianWang","id":4529189,"avatar_url":"https://avatars.githubusercontent.com/u/4529189?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhongtianWang","html_url":"https://github.com/ZhongtianWang","followers_url":"https://api.github.com/users/ZhongtianWang/followers","following_url":"https://api.github.com/users/ZhongtianWang/following{/other_user}","gists_url":"https://api.github.com/users/ZhongtianWang/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhongtianWang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhongtianWang/subscriptions","organizations_url":"https://api.github.com/users/ZhongtianWang/orgs","repos_url":"https://api.github.com/users/ZhongtianWang/repos","events_url":"https://api.github.com/users/ZhongtianWang/events{/privacy}","received_events_url":"https://api.github.com/users/ZhongtianWang/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/NetSys/quilt/pulls/433/commits","review_comments_url":"https://api.github.com/repos/NetSys/quilt/pulls/433/comments","review_comment_url":"https://api.github.com/repos/NetSys/quilt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NetSys/quilt/issues/433/comments","statuses_url":"https://api.github.com/repos/NetSys/quilt/statuses/5107a164e3a636cbc5991c65984f0d45b02b66aa","head":{"label":"akshayknarayan:assertions","ref":"assertions","sha":"5107a164e3a636cbc5991c65984f0d45b02b66aa","user":{"login":"akshayknarayan","id":3051943,"avatar_url":"https://avatars.githubusercontent.com/u/3051943?v=3","gravatar_id":"","url":"https://api.github.com/users/akshayknarayan","html_url":"https://github.com/akshayknarayan","followers_url":"https://api.github.com/users/akshayknarayan/followers","following_url":"https://api.github.com/users/akshayknarayan/following{/other_user}","gists_url":"https://api.github.com/users/akshayknarayan/gists{/gist_id}","starred_url":"https://api.github.com/users/akshayknarayan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshayknarayan/subscriptions","organizations_url":"https://api.github.com/users/akshayknarayan/orgs","repos_url":"https://api.github.com/users/akshayknarayan/repos","events_url":"https://api.github.com/users/akshayknarayan/events{/privacy}","received_events_url":"https://api.github.com/users/akshayknarayan/received_events","type":"User","site_admin":false},"repo":{"id":59779586,"name":"quilt","full_name":"akshayknarayan/quilt","owner":{"login":"akshayknarayan","id":3051943,"avatar_url":"https://avatars.githubusercontent.com/u/3051943?v=3","gravatar_id":"","url":"https://api.github.com/users/akshayknarayan","html_url":"https://github.com/akshayknarayan","followers_url":"https://api.github.com/users/akshayknarayan/followers","following_url":"https://api.github.com/users/akshayknarayan/following{/other_user}","gists_url":"https://api.github.com/users/akshayknarayan/gists{/gist_id}","starred_url":"https://api.github.com/users/akshayknarayan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshayknarayan/subscriptions","organizations_url":"https://api.github.com/users/akshayknarayan/orgs","repos_url":"https://api.github.com/users/akshayknarayan/repos","events_url":"https://api.github.com/users/akshayknarayan/events{/privacy}","received_events_url":"https://api.github.com/users/akshayknarayan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/akshayknarayan/quilt","description":"Quilt","fork":true,"url":"https://api.github.com/repos/akshayknarayan/quilt","forks_url":"https://api.github.com/repos/akshayknarayan/quilt/forks","keys_url":"https://api.github.com/repos/akshayknarayan/quilt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akshayknarayan/quilt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akshayknarayan/quilt/teams","hooks_url":"https://api.github.com/repos/akshayknarayan/quilt/hooks","issue_events_url":"https://api.github.com/repos/akshayknarayan/quilt/issues/events{/number}","events_url":"https://api.github.com/repos/akshayknarayan/quilt/events","assignees_url":"https://api.github.com/repos/akshayknarayan/quilt/assignees{/user}","branches_url":"https://api.github.com/repos/akshayknarayan/quilt/branches{/branch}","tags_url":"https://api.github.com/repos/akshayknarayan/quilt/tags","blobs_url":"https://api.github.com/repos/akshayknarayan/quilt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akshayknarayan/quilt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akshayknarayan/quilt/git/refs{/sha}","trees_url":"https://api.github.com/repos/akshayknarayan/quilt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akshayknarayan/quilt/statuses/{sha}","languages_url":"https://api.github.com/repos/akshayknarayan/quilt/languages","stargazers_url":"https://api.github.com/repos/akshayknarayan/quilt/stargazers","contributors_url":"https://api.github.com/repos/akshayknarayan/quilt/contributors","subscribers_url":"https://api.github.com/repos/akshayknarayan/quilt/subscribers","subscription_url":"https://api.github.com/repos/akshayknarayan/quilt/subscription","commits_url":"https://api.github.com/repos/akshayknarayan/quilt/commits{/sha}","git_commits_url":"https://api.github.com/repos/akshayknarayan/quilt/git/commits{/sha}","comments_url":"https://api.github.com/repos/akshayknarayan/quilt/comments{/number}","issue_comment_url":"https://api.github.com/repos/akshayknarayan/quilt/issues/comments{/number}","contents_url":"https://api.github.com/repos/akshayknarayan/quilt/contents/{+path}","compare_url":"https://api.github.com/repos/akshayknarayan/quilt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akshayknarayan/quilt/merges","archive_url":"https://api.github.com/repos/akshayknarayan/quilt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akshayknarayan/quilt/downloads","issues_url":"https://api.github.com/repos/akshayknarayan/quilt/issues{/number}","pulls_url":"https://api.github.com/repos/akshayknarayan/quilt/pulls{/number}","milestones_url":"https://api.github.com/repos/akshayknarayan/quilt/milestones{/number}","notifications_url":"https://api.github.com/repos/akshayknarayan/quilt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akshayknarayan/quilt/labels{/name}","releases_url":"https://api.github.com/repos/akshayknarayan/quilt/releases{/id}","deployments_url":"https://api.github.com/repos/akshayknarayan/quilt/deployments","created_at":"2016-05-26T20:00:42Z","updated_at":"2016-05-26T20:00:44Z","pushed_at":"2016-06-14T19:16:00Z","git_url":"git://github.com/akshayknarayan/quilt.git","ssh_url":"git@github.com:akshayknarayan/quilt.git","clone_url":"https://github.com/akshayknarayan/quilt.git","svn_url":"https://github.com/akshayknarayan/quilt","homepage":"","size":14435,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NetSys:master","ref":"master","sha":"eee56ce08319a6971c3d87905fb3ddd3ce608462","user":{"login":"NetSys","id":3665805,"avatar_url":"https://avatars.githubusercontent.com/u/3665805?v=3","gravatar_id":"","url":"https://api.github.com/users/NetSys","html_url":"https://github.com/NetSys","followers_url":"https://api.github.com/users/NetSys/followers","following_url":"https://api.github.com/users/NetSys/following{/other_user}","gists_url":"https://api.github.com/users/NetSys/gists{/gist_id}","starred_url":"https://api.github.com/users/NetSys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NetSys/subscriptions","organizations_url":"https://api.github.com/users/NetSys/orgs","repos_url":"https://api.github.com/users/NetSys/repos","events_url":"https://api.github.com/users/NetSys/events{/privacy}","received_events_url":"https://api.github.com/users/NetSys/received_events","type":"Organization","site_admin":false},"repo":{"id":43390663,"name":"quilt","full_name":"NetSys/quilt","owner":{"login":"NetSys","id":3665805,"avatar_url":"https://avatars.githubusercontent.com/u/3665805?v=3","gravatar_id":"","url":"https://api.github.com/users/NetSys","html_url":"https://github.com/NetSys","followers_url":"https://api.github.com/users/NetSys/followers","following_url":"https://api.github.com/users/NetSys/following{/other_user}","gists_url":"https://api.github.com/users/NetSys/gists{/gist_id}","starred_url":"https://api.github.com/users/NetSys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NetSys/subscriptions","organizations_url":"https://api.github.com/users/NetSys/orgs","repos_url":"https://api.github.com/users/NetSys/repos","events_url":"https://api.github.com/users/NetSys/events{/privacy}","received_events_url":"https://api.github.com/users/NetSys/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NetSys/quilt","description":"Quilt","fork":false,"url":"https://api.github.com/repos/NetSys/quilt","forks_url":"https://api.github.com/repos/NetSys/quilt/forks","keys_url":"https://api.github.com/repos/NetSys/quilt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NetSys/quilt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NetSys/quilt/teams","hooks_url":"https://api.github.com/repos/NetSys/quilt/hooks","issue_events_url":"https://api.github.com/repos/NetSys/quilt/issues/events{/number}","events_url":"https://api.github.com/repos/NetSys/quilt/events","assignees_url":"https://api.github.com/repos/NetSys/quilt/assignees{/user}","branches_url":"https://api.github.com/repos/NetSys/quilt/branches{/branch}","tags_url":"https://api.github.com/repos/NetSys/quilt/tags","blobs_url":"https://api.github.com/repos/NetSys/quilt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NetSys/quilt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NetSys/quilt/git/refs{/sha}","trees_url":"https://api.github.com/repos/NetSys/quilt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NetSys/quilt/statuses/{sha}","languages_url":"https://api.github.com/repos/NetSys/quilt/languages","stargazers_url":"https://api.github.com/repos/NetSys/quilt/stargazers","contributors_url":"https://api.github.com/repos/NetSys/quilt/contributors","subscribers_url":"https://api.github.com/repos/NetSys/quilt/subscribers","subscription_url":"https://api.github.com/repos/NetSys/quilt/subscription","commits_url":"https://api.github.com/repos/NetSys/quilt/commits{/sha}","git_commits_url":"https://api.github.com/repos/NetSys/quilt/git/commits{/sha}","comments_url":"https://api.github.com/repos/NetSys/quilt/comments{/number}","issue_comment_url":"https://api.github.com/repos/NetSys/quilt/issues/comments{/number}","contents_url":"https://api.github.com/repos/NetSys/quilt/contents/{+path}","compare_url":"https://api.github.com/repos/NetSys/quilt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NetSys/quilt/merges","archive_url":"https://api.github.com/repos/NetSys/quilt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NetSys/quilt/downloads","issues_url":"https://api.github.com/repos/NetSys/quilt/issues{/number}","pulls_url":"https://api.github.com/repos/NetSys/quilt/pulls{/number}","milestones_url":"https://api.github.com/repos/NetSys/quilt/milestones{/number}","notifications_url":"https://api.github.com/repos/NetSys/quilt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NetSys/quilt/labels{/name}","releases_url":"https://api.github.com/repos/NetSys/quilt/releases{/id}","deployments_url":"https://api.github.com/repos/NetSys/quilt/deployments","created_at":"2015-09-29T19:52:32Z","updated_at":"2016-06-13T14:26:18Z","pushed_at":"2016-06-20T02:29:54Z","git_url":"git://github.com/NetSys/quilt.git","ssh_url":"git@github.com:NetSys/quilt.git","clone_url":"https://github.com/NetSys/quilt.git","svn_url":"https://github.com/NetSys/quilt","homepage":"","size":22497,"stargazers_count":14,"watchers_count":14,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":105,"forks":8,"open_issues":105,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/433"},"html":{"href":"https://github.com/NetSys/quilt/pull/433"},"issue":{"href":"https://api.github.com/repos/NetSys/quilt/issues/433"},"comments":{"href":"https://api.github.com/repos/NetSys/quilt/issues/433/comments"},"review_comments":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/433/comments"},"review_comment":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NetSys/quilt/pulls/433/commits"},"statuses":{"href":"https://api.github.com/repos/NetSys/quilt/statuses/5107a164e3a636cbc5991c65984f0d45b02b66aa"}}}}
{"actor":{"display_login":"ZhongtianWang"}}