{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/rocket/pulls/comments/22878818","id":22878818,"diff_hunk":"@@ -0,0 +1,165 @@\n+// Copyright 2014 CoreOS, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package main\n+\n+import (\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"os\"\n+\t\"path/filepath\"\n+\n+\t\"github.com/coreos/rocket/pkg/lock\"\n+)\n+\n+type containerHandle struct {\n+\tuuid       string\n+\tlock       *lock.DirLock\n+\tisExited   bool\n+\tisGarbage  bool\n+\tisDeleting bool\n+}\n+\n+type includeMask byte\n+\n+const (\n+\tincludeContainersDir includeMask = 1 << iota\n+\tincludeGarbageDir\n+)\n+\n+// getContainerHandles returns a slice of ContainerHandle structs representing the current state of all containers\n+func getContainerHandles(include includeMask) ([]*containerHandle, error) {\n+\tls, err := getContainers(include)\n+\tif err != nil {\n+\t\treturn nil, fmt.Errorf(\"failed to get containers: %v\", err)\n+\t}\n+\n+\tvar cs []*containerHandle\n+\tfor _, uuid := range ls {\n+\t\tstate, err := getContainerHandle(uuid)\n+\t\tif err != nil {\n+\t\t\tfmt.Fprintf(os.Stderr, \"Error getting state of container %s, ignoring\\n\", uuid)\n+\t\t\tcontinue\n+\t\t}\n+\t\tcs = append(cs, state)\n+\t}\n+\n+\treturn cs, nil\n+}\n+\n+// getContainerHandle returns a ContainerHandle struct representing the given container\n+func getContainerHandle(uuid string) (*containerHandle, error) {","path":"rkt/containers.go","position":62,"original_position":62,"commit_id":"9e6b2d916fbbf410566fc1eeab31a6d6065cd694","original_commit_id":"9e6b2d916fbbf410566fc1eeab31a6d6065cd694","user":{"login":"kelseyhightower","id":1123322,"avatar_url":"https://avatars.githubusercontent.com/u/1123322?v=3","gravatar_id":"","url":"https://api.github.com/users/kelseyhightower","html_url":"https://github.com/kelseyhightower","followers_url":"https://api.github.com/users/kelseyhightower/followers","following_url":"https://api.github.com/users/kelseyhightower/following{/other_user}","gists_url":"https://api.github.com/users/kelseyhightower/gists{/gist_id}","starred_url":"https://api.github.com/users/kelseyhightower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelseyhightower/subscriptions","organizations_url":"https://api.github.com/users/kelseyhightower/orgs","repos_url":"https://api.github.com/users/kelseyhightower/repos","events_url":"https://api.github.com/users/kelseyhightower/events{/privacy}","received_events_url":"https://api.github.com/users/kelseyhightower/received_events","type":"User","site_admin":false},"body":"Yes. I see that now. Thanks.","created_at":"2015-01-13T17:39:09Z","updated_at":"2015-01-13T17:39:09Z","html_url":"https://github.com/coreos/rocket/pull/371#discussion_r22878818","pull_request_url":"https://api.github.com/repos/coreos/rocket/pulls/371","_links":{"self":{"href":"https://api.github.com/repos/coreos/rocket/pulls/comments/22878818"},"html":{"href":"https://github.com/coreos/rocket/pull/371#discussion_r22878818"},"pull_request":{"href":"https://api.github.com/repos/coreos/rocket/pulls/371"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/rocket/pulls/371","id":27245430,"html_url":"https://github.com/coreos/rocket/pull/371","diff_url":"https://github.com/coreos/rocket/pull/371.diff","patch_url":"https://github.com/coreos/rocket/pull/371.patch","issue_url":"https://api.github.com/repos/coreos/rocket/issues/371","number":371,"state":"open","locked":false,"title":"rkt/containers: introduce a general api to the container dirs","user":{"login":"vcaputo","id":1452963,"avatar_url":"https://avatars.githubusercontent.com/u/1452963?v=3","gravatar_id":"","url":"https://api.github.com/users/vcaputo","html_url":"https://github.com/vcaputo","followers_url":"https://api.github.com/users/vcaputo/followers","following_url":"https://api.github.com/users/vcaputo/following{/other_user}","gists_url":"https://api.github.com/users/vcaputo/gists{/gist_id}","starred_url":"https://api.github.com/users/vcaputo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vcaputo/subscriptions","organizations_url":"https://api.github.com/users/vcaputo/orgs","repos_url":"https://api.github.com/users/vcaputo/repos","events_url":"https://api.github.com/users/vcaputo/events{/privacy}","received_events_url":"https://api.github.com/users/vcaputo/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-13T03:14:17Z","updated_at":"2015-01-13T17:39:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb99c42dfbc4f38e09866d42b66ae8bbca0a8a73","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/rocket/pulls/371/commits","review_comments_url":"https://api.github.com/repos/coreos/rocket/pulls/371/comments","review_comment_url":"https://api.github.com/repos/coreos/rocket/pulls/comments/{number}","comments_url":"https://api.github.com/repos/coreos/rocket/issues/371/comments","statuses_url":"https://api.github.com/repos/coreos/rocket/statuses/9e6b2d916fbbf410566fc1eeab31a6d6065cd694","head":{"label":"vcaputo:factor_containers","ref":"factor_containers","sha":"9e6b2d916fbbf410566fc1eeab31a6d6065cd694","user":{"login":"vcaputo","id":1452963,"avatar_url":"https://avatars.githubusercontent.com/u/1452963?v=3","gravatar_id":"","url":"https://api.github.com/users/vcaputo","html_url":"https://github.com/vcaputo","followers_url":"https://api.github.com/users/vcaputo/followers","following_url":"https://api.github.com/users/vcaputo/following{/other_user}","gists_url":"https://api.github.com/users/vcaputo/gists{/gist_id}","starred_url":"https://api.github.com/users/vcaputo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vcaputo/subscriptions","organizations_url":"https://api.github.com/users/vcaputo/orgs","repos_url":"https://api.github.com/users/vcaputo/repos","events_url":"https://api.github.com/users/vcaputo/events{/privacy}","received_events_url":"https://api.github.com/users/vcaputo/received_events","type":"User","site_admin":false},"repo":{"id":27401830,"name":"rocket","full_name":"vcaputo/rocket","owner":{"login":"vcaputo","id":1452963,"avatar_url":"https://avatars.githubusercontent.com/u/1452963?v=3","gravatar_id":"","url":"https://api.github.com/users/vcaputo","html_url":"https://github.com/vcaputo","followers_url":"https://api.github.com/users/vcaputo/followers","following_url":"https://api.github.com/users/vcaputo/following{/other_user}","gists_url":"https://api.github.com/users/vcaputo/gists{/gist_id}","starred_url":"https://api.github.com/users/vcaputo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vcaputo/subscriptions","organizations_url":"https://api.github.com/users/vcaputo/orgs","repos_url":"https://api.github.com/users/vcaputo/repos","events_url":"https://api.github.com/users/vcaputo/events{/privacy}","received_events_url":"https://api.github.com/users/vcaputo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vcaputo/rocket","description":"App Container runtime","fork":true,"url":"https://api.github.com/repos/vcaputo/rocket","forks_url":"https://api.github.com/repos/vcaputo/rocket/forks","keys_url":"https://api.github.com/repos/vcaputo/rocket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vcaputo/rocket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vcaputo/rocket/teams","hooks_url":"https://api.github.com/repos/vcaputo/rocket/hooks","issue_events_url":"https://api.github.com/repos/vcaputo/rocket/issues/events{/number}","events_url":"https://api.github.com/repos/vcaputo/rocket/events","assignees_url":"https://api.github.com/repos/vcaputo/rocket/assignees{/user}","branches_url":"https://api.github.com/repos/vcaputo/rocket/branches{/branch}","tags_url":"https://api.github.com/repos/vcaputo/rocket/tags","blobs_url":"https://api.github.com/repos/vcaputo/rocket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vcaputo/rocket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vcaputo/rocket/git/refs{/sha}","trees_url":"https://api.github.com/repos/vcaputo/rocket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vcaputo/rocket/statuses/{sha}","languages_url":"https://api.github.com/repos/vcaputo/rocket/languages","stargazers_url":"https://api.github.com/repos/vcaputo/rocket/stargazers","contributors_url":"https://api.github.com/repos/vcaputo/rocket/contributors","subscribers_url":"https://api.github.com/repos/vcaputo/rocket/subscribers","subscription_url":"https://api.github.com/repos/vcaputo/rocket/subscription","commits_url":"https://api.github.com/repos/vcaputo/rocket/commits{/sha}","git_commits_url":"https://api.github.com/repos/vcaputo/rocket/git/commits{/sha}","comments_url":"https://api.github.com/repos/vcaputo/rocket/comments{/number}","issue_comment_url":"https://api.github.com/repos/vcaputo/rocket/issues/comments/{number}","contents_url":"https://api.github.com/repos/vcaputo/rocket/contents/{+path}","compare_url":"https://api.github.com/repos/vcaputo/rocket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vcaputo/rocket/merges","archive_url":"https://api.github.com/repos/vcaputo/rocket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vcaputo/rocket/downloads","issues_url":"https://api.github.com/repos/vcaputo/rocket/issues{/number}","pulls_url":"https://api.github.com/repos/vcaputo/rocket/pulls{/number}","milestones_url":"https://api.github.com/repos/vcaputo/rocket/milestones{/number}","notifications_url":"https://api.github.com/repos/vcaputo/rocket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vcaputo/rocket/labels{/name}","releases_url":"https://api.github.com/repos/vcaputo/rocket/releases{/id}","created_at":"2014-12-01T21:54:09Z","updated_at":"2014-12-01T21:54:10Z","pushed_at":"2015-01-13T03:13:19Z","git_url":"git://github.com/vcaputo/rocket.git","ssh_url":"git@github.com:vcaputo/rocket.git","clone_url":"https://github.com/vcaputo/rocket.git","svn_url":"https://github.com/vcaputo/rocket","homepage":"","size":1567,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"3d30cd9afb7bfd769a4963a644d0e83cff4ce574","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":26509369,"name":"rocket","full_name":"coreos/rocket","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/rocket","description":"App Container runtime","fork":false,"url":"https://api.github.com/repos/coreos/rocket","forks_url":"https://api.github.com/repos/coreos/rocket/forks","keys_url":"https://api.github.com/repos/coreos/rocket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/rocket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/rocket/teams","hooks_url":"https://api.github.com/repos/coreos/rocket/hooks","issue_events_url":"https://api.github.com/repos/coreos/rocket/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/rocket/events","assignees_url":"https://api.github.com/repos/coreos/rocket/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/rocket/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/rocket/tags","blobs_url":"https://api.github.com/repos/coreos/rocket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/rocket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/rocket/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/rocket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/rocket/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/rocket/languages","stargazers_url":"https://api.github.com/repos/coreos/rocket/stargazers","contributors_url":"https://api.github.com/repos/coreos/rocket/contributors","subscribers_url":"https://api.github.com/repos/coreos/rocket/subscribers","subscription_url":"https://api.github.com/repos/coreos/rocket/subscription","commits_url":"https://api.github.com/repos/coreos/rocket/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/rocket/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/rocket/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/rocket/issues/comments/{number}","contents_url":"https://api.github.com/repos/coreos/rocket/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/rocket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/rocket/merges","archive_url":"https://api.github.com/repos/coreos/rocket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/rocket/downloads","issues_url":"https://api.github.com/repos/coreos/rocket/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/rocket/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/rocket/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/rocket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/rocket/labels{/name}","releases_url":"https://api.github.com/repos/coreos/rocket/releases{/id}","created_at":"2014-11-11T23:13:18Z","updated_at":"2015-01-13T16:22:22Z","pushed_at":"2015-01-13T08:31:54Z","git_url":"git://github.com/coreos/rocket.git","ssh_url":"git@github.com:coreos/rocket.git","clone_url":"https://github.com/coreos/rocket.git","svn_url":"https://github.com/coreos/rocket","homepage":"","size":4919,"stargazers_count":3131,"watchers_count":3131,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":214,"mirror_url":null,"open_issues_count":56,"forks":214,"open_issues":56,"watchers":3131,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/rocket/pulls/371"},"html":{"href":"https://github.com/coreos/rocket/pull/371"},"issue":{"href":"https://api.github.com/repos/coreos/rocket/issues/371"},"comments":{"href":"https://api.github.com/repos/coreos/rocket/issues/371/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/rocket/pulls/371/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/rocket/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/coreos/rocket/pulls/371/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/rocket/statuses/9e6b2d916fbbf410566fc1eeab31a6d6065cd694"}}}}