{"action":"created","comment":{"url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/comments/27347667","id":27347667,"diff_hunk":"@@ -0,0 +1,123 @@\n+package baps3\n+\n+// The part of the BAPS3 connector code responsible for updating the\n+// internal state.\n+\n+import (\n+\t\"fmt\"\n+\t\"strconv\"\n+\t\"time\"\n+)\n+\n+// ServiceState is the struct of all known state for a BAPS3 service.\n+// TODO(CaptainHayashi): possibly segregate more by feature, so elements not\n+// relevant to the current feature set aren't allocated?\n+type ServiceState struct {\n+\t// Core\n+\tFeatures FeatureSet\n+\tState    string\n+\n+\t// TimeReport\n+\tTime time.Duration\n+\n+\t// FileLoad\n+\tFile string\n+}\n+\n+// InitServiceState creates a new, blank, ServiceState.\n+func InitServiceState() (s *ServiceState) {\n+\ts = new(ServiceState)\n+\ts.Features = FeatureSet{}\n+\ts.State = \"Ready\"\n+\n+\treturn\n+}\n+\n+// Update updates a ServiceState according to an incoming service response.\n+func (s *ServiceState) Update(res Message) (err error) {\n+\tswitch res.Word() {\n+\tcase RsFeatures:\n+\t\terr = s.updateFeaturesFromMessage(res)\n+\tcase RsFile:\n+\t\terr = s.updateFileFromMessage(res)\n+\tcase RsState:\n+\t\terr = s.updateStateFromMessage(res)\n+\tcase RsTime:\n+\t\terr = s.updateTimeFromMessage(res)\n+\t}\n+\n+\treturn","path":"service_state.go","position":49,"original_position":49,"commit_id":"9d804a140871666ba24b68da938f07bb540d3316","original_commit_id":"9d804a140871666ba24b68da938f07bb540d3316","user":{"login":"LordAro","id":4007992,"avatar_url":"https://avatars.githubusercontent.com/u/4007992?v=3","gravatar_id":"","url":"https://api.github.com/users/LordAro","html_url":"https://github.com/LordAro","followers_url":"https://api.github.com/users/LordAro/followers","following_url":"https://api.github.com/users/LordAro/following{/other_user}","gists_url":"https://api.github.com/users/LordAro/gists{/gist_id}","starred_url":"https://api.github.com/users/LordAro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LordAro/subscriptions","organizations_url":"https://api.github.com/users/LordAro/orgs","repos_url":"https://api.github.com/users/LordAro/repos","events_url":"https://api.github.com/users/LordAro/events{/privacy}","received_events_url":"https://api.github.com/users/LordAro/received_events","type":"User","site_admin":false},"body":"maybe replace named return with individual return statements?","created_at":"2015-03-28T19:31:25Z","updated_at":"2015-03-28T19:31:25Z","html_url":"https://github.com/UniversityRadioYork/baps3-go/pull/10#discussion_r27347667","pull_request_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/comments/27347667"},"html":{"href":"https://github.com/UniversityRadioYork/baps3-go/pull/10#discussion_r27347667"},"pull_request":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/10","id":32169710,"html_url":"https://github.com/UniversityRadioYork/baps3-go/pull/10","diff_url":"https://github.com/UniversityRadioYork/baps3-go/pull/10.diff","patch_url":"https://github.com/UniversityRadioYork/baps3-go/pull/10.patch","issue_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/10","number":10,"state":"open","locked":false,"title":"Add service state","user":{"login":"wlcx","id":3065381,"avatar_url":"https://avatars.githubusercontent.com/u/3065381?v=3","gravatar_id":"","url":"https://api.github.com/users/wlcx","html_url":"https://github.com/wlcx","followers_url":"https://api.github.com/users/wlcx/followers","following_url":"https://api.github.com/users/wlcx/following{/other_user}","gists_url":"https://api.github.com/users/wlcx/gists{/gist_id}","starred_url":"https://api.github.com/users/wlcx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlcx/subscriptions","organizations_url":"https://api.github.com/users/wlcx/orgs","repos_url":"https://api.github.com/users/wlcx/repos","events_url":"https://api.github.com/users/wlcx/events{/privacy}","received_events_url":"https://api.github.com/users/wlcx/received_events","type":"User","site_admin":false},"body":"Adds the ServiceState structure from bifrost\r\nExports necessary members and methods\r\nUpdates features to use featuresets","created_at":"2015-03-28T19:26:36Z","updated_at":"2015-03-28T19:31:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fbd65fdb783f6752411cbccb549ddc1008f6965","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/10/commits","review_comments_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/10/comments","review_comment_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/10/comments","statuses_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/statuses/9d804a140871666ba24b68da938f07bb540d3316","head":{"label":"UniversityRadioYork:add-service-state","ref":"add-service-state","sha":"9d804a140871666ba24b68da938f07bb540d3316","user":{"login":"UniversityRadioYork","id":823554,"avatar_url":"https://avatars.githubusercontent.com/u/823554?v=3","gravatar_id":"","url":"https://api.github.com/users/UniversityRadioYork","html_url":"https://github.com/UniversityRadioYork","followers_url":"https://api.github.com/users/UniversityRadioYork/followers","following_url":"https://api.github.com/users/UniversityRadioYork/following{/other_user}","gists_url":"https://api.github.com/users/UniversityRadioYork/gists{/gist_id}","starred_url":"https://api.github.com/users/UniversityRadioYork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniversityRadioYork/subscriptions","organizations_url":"https://api.github.com/users/UniversityRadioYork/orgs","repos_url":"https://api.github.com/users/UniversityRadioYork/repos","events_url":"https://api.github.com/users/UniversityRadioYork/events{/privacy}","received_events_url":"https://api.github.com/users/UniversityRadioYork/received_events","type":"Organization","site_admin":false},"repo":{"id":31230951,"name":"baps3-go","full_name":"UniversityRadioYork/baps3-go","owner":{"login":"UniversityRadioYork","id":823554,"avatar_url":"https://avatars.githubusercontent.com/u/823554?v=3","gravatar_id":"","url":"https://api.github.com/users/UniversityRadioYork","html_url":"https://github.com/UniversityRadioYork","followers_url":"https://api.github.com/users/UniversityRadioYork/followers","following_url":"https://api.github.com/users/UniversityRadioYork/following{/other_user}","gists_url":"https://api.github.com/users/UniversityRadioYork/gists{/gist_id}","starred_url":"https://api.github.com/users/UniversityRadioYork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniversityRadioYork/subscriptions","organizations_url":"https://api.github.com/users/UniversityRadioYork/orgs","repos_url":"https://api.github.com/users/UniversityRadioYork/repos","events_url":"https://api.github.com/users/UniversityRadioYork/events{/privacy}","received_events_url":"https://api.github.com/users/UniversityRadioYork/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UniversityRadioYork/baps3-go","description":"BAPS3 protocol Go package","fork":false,"url":"https://api.github.com/repos/UniversityRadioYork/baps3-go","forks_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/forks","keys_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/teams","hooks_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/hooks","issue_events_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/events{/number}","events_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/events","assignees_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/assignees{/user}","branches_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/branches{/branch}","tags_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/tags","blobs_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/statuses/{sha}","languages_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/languages","stargazers_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/stargazers","contributors_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/contributors","subscribers_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/subscribers","subscription_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/subscription","commits_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/contents/{+path}","compare_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/merges","archive_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/downloads","issues_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues{/number}","pulls_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls{/number}","milestones_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/milestones{/number}","notifications_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/labels{/name}","releases_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/releases{/id}","created_at":"2015-02-23T21:32:24Z","updated_at":"2015-03-28T16:18:47Z","pushed_at":"2015-03-28T19:26:36Z","git_url":"git://github.com/UniversityRadioYork/baps3-go.git","ssh_url":"git@github.com:UniversityRadioYork/baps3-go.git","clone_url":"https://github.com/UniversityRadioYork/baps3-go.git","svn_url":"https://github.com/UniversityRadioYork/baps3-go","homepage":null,"size":276,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"UniversityRadioYork:master","ref":"master","sha":"8bfe01a7302beaf02e54578be62fa2824e7ae591","user":{"login":"UniversityRadioYork","id":823554,"avatar_url":"https://avatars.githubusercontent.com/u/823554?v=3","gravatar_id":"","url":"https://api.github.com/users/UniversityRadioYork","html_url":"https://github.com/UniversityRadioYork","followers_url":"https://api.github.com/users/UniversityRadioYork/followers","following_url":"https://api.github.com/users/UniversityRadioYork/following{/other_user}","gists_url":"https://api.github.com/users/UniversityRadioYork/gists{/gist_id}","starred_url":"https://api.github.com/users/UniversityRadioYork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniversityRadioYork/subscriptions","organizations_url":"https://api.github.com/users/UniversityRadioYork/orgs","repos_url":"https://api.github.com/users/UniversityRadioYork/repos","events_url":"https://api.github.com/users/UniversityRadioYork/events{/privacy}","received_events_url":"https://api.github.com/users/UniversityRadioYork/received_events","type":"Organization","site_admin":false},"repo":{"id":31230951,"name":"baps3-go","full_name":"UniversityRadioYork/baps3-go","owner":{"login":"UniversityRadioYork","id":823554,"avatar_url":"https://avatars.githubusercontent.com/u/823554?v=3","gravatar_id":"","url":"https://api.github.com/users/UniversityRadioYork","html_url":"https://github.com/UniversityRadioYork","followers_url":"https://api.github.com/users/UniversityRadioYork/followers","following_url":"https://api.github.com/users/UniversityRadioYork/following{/other_user}","gists_url":"https://api.github.com/users/UniversityRadioYork/gists{/gist_id}","starred_url":"https://api.github.com/users/UniversityRadioYork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniversityRadioYork/subscriptions","organizations_url":"https://api.github.com/users/UniversityRadioYork/orgs","repos_url":"https://api.github.com/users/UniversityRadioYork/repos","events_url":"https://api.github.com/users/UniversityRadioYork/events{/privacy}","received_events_url":"https://api.github.com/users/UniversityRadioYork/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UniversityRadioYork/baps3-go","description":"BAPS3 protocol Go package","fork":false,"url":"https://api.github.com/repos/UniversityRadioYork/baps3-go","forks_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/forks","keys_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/teams","hooks_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/hooks","issue_events_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/events{/number}","events_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/events","assignees_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/assignees{/user}","branches_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/branches{/branch}","tags_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/tags","blobs_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/statuses/{sha}","languages_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/languages","stargazers_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/stargazers","contributors_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/contributors","subscribers_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/subscribers","subscription_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/subscription","commits_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/contents/{+path}","compare_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/merges","archive_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/downloads","issues_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues{/number}","pulls_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls{/number}","milestones_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/milestones{/number}","notifications_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/labels{/name}","releases_url":"https://api.github.com/repos/UniversityRadioYork/baps3-go/releases{/id}","created_at":"2015-02-23T21:32:24Z","updated_at":"2015-03-28T16:18:47Z","pushed_at":"2015-03-28T19:26:36Z","git_url":"git://github.com/UniversityRadioYork/baps3-go.git","ssh_url":"git@github.com:UniversityRadioYork/baps3-go.git","clone_url":"https://github.com/UniversityRadioYork/baps3-go.git","svn_url":"https://github.com/UniversityRadioYork/baps3-go","homepage":null,"size":276,"stargazers_count":0,"watchers_count":0,"language":"Go","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/UniversityRadioYork/baps3-go/pulls/10"},"html":{"href":"https://github.com/UniversityRadioYork/baps3-go/pull/10"},"issue":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/10"},"comments":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/UniversityRadioYork/baps3-go/statuses/9d804a140871666ba24b68da938f07bb540d3316"}}}}