{"action":"created","comment":{"url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments/123006586","pull_request_review_id":45169119,"id":123006586,"diff_hunk":"@@ -0,0 +1,153 @@\n+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file\n+// for details. All rights reserved. Use of this source code is governed by a\n+// BSD-style license that can be found in the LICENSE file.\n+\n+import 'dart:async';\n+import 'dart:math';\n+\n+import 'package:gcloud/db.dart';\n+\n+import '../shared/utils.dart';\n+\n+import 'models.dart';\n+\n+final Random _random = new Random.secure();\n+\n+class AnalysisBackend {\n+  final DatastoreDB db;\n+\n+  AnalysisBackend(this.db);\n+\n+  Future<Analysis> getAnalysis(String package,\n+      [String version, String analysis]) async {\n+    final Key packageKey = db.emptyKey.append(PackageAnalysis, id: package);\n+\n+    Future<Analysis> loadRollup(AnalysisRollup rollup) async {\n+      if (rollup == null) return null;\n+      return (await db.lookup([rollup.analysisKey]))[0];\n+    }\n+\n+    if (version == null) {\n+      final List list = await db.lookup([packageKey]);\n+      return loadRollup(list[0]);\n+    }\n+\n+    // version was set\n+    final Key versionKey =\n+        packageKey.append(PackageVersionAnalysis, id: version);\n+\n+    if (analysis == null) {\n+      final List list = await db.lookup([versionKey]);","path":"app/lib/analyzer/backend.dart","position":40,"original_position":40,"commit_id":"aa16b084de33080ba855a694d3f7bb9c9187ddfa","original_commit_id":"aa16b084de33080ba855a694d3f7bb9c9187ddfa","user":{"login":"kevmoo","id":17034,"avatar_url":"https://avatars1.githubusercontent.com/u/17034?v=3","gravatar_id":"","url":"https://api.github.com/users/kevmoo","html_url":"https://github.com/kevmoo","followers_url":"https://api.github.com/users/kevmoo/followers","following_url":"https://api.github.com/users/kevmoo/following{/other_user}","gists_url":"https://api.github.com/users/kevmoo/gists{/gist_id}","starred_url":"https://api.github.com/users/kevmoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevmoo/subscriptions","organizations_url":"https://api.github.com/users/kevmoo/orgs","repos_url":"https://api.github.com/users/kevmoo/repos","events_url":"https://api.github.com/users/kevmoo/events{/privacy}","received_events_url":"https://api.github.com/users/kevmoo/received_events","type":"User","site_admin":false},"body":"`var list` is fine, too.\r\n\r\nhttps://www.dartlang.org/guides/language/effective-dart/usage#consider-omitting-the-types-for-local-variables\r\n\r\n😄 ","created_at":"2017-06-20T15:17:04Z","updated_at":"2017-06-20T15:18:08Z","html_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/177#discussion_r123006586","pull_request_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177","_links":{"self":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments/123006586"},"html":{"href":"https://github.com/dart-lang/pub-dartlang-dart/pull/177#discussion_r123006586"},"pull_request":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177"}}},"pull_request":{"url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177","id":126544955,"html_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/177","diff_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/177.diff","patch_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/177.patch","issue_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/177","number":177,"state":"open","locked":false,"title":"Analyzer model + backend","user":{"login":"isoos","id":4778111,"avatar_url":"https://avatars2.githubusercontent.com/u/4778111?v=3","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"body":"Datastore model + a bit of backend operations (to store and get the analysis model object).","created_at":"2017-06-20T14:19:47Z","updated_at":"2017-06-20T15:18:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e36bd1f7739e4ac11b86a24e359f2a4ab00eedb0","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177/commits","review_comments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177/comments","review_comment_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/177/comments","statuses_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/statuses/aa16b084de33080ba855a694d3f7bb9c9187ddfa","head":{"label":"isoos:analyzer_model","ref":"analyzer_model","sha":"aa16b084de33080ba855a694d3f7bb9c9187ddfa","user":{"login":"isoos","id":4778111,"avatar_url":"https://avatars2.githubusercontent.com/u/4778111?v=3","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"repo":{"id":86555243,"name":"pub-dartlang-dart","full_name":"isoos/pub-dartlang-dart","owner":{"login":"isoos","id":4778111,"avatar_url":"https://avatars2.githubusercontent.com/u/4778111?v=3","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/isoos/pub-dartlang-dart","description":"The pub.dartlang.org site in Dart","fork":true,"url":"https://api.github.com/repos/isoos/pub-dartlang-dart","forks_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/forks","keys_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/teams","hooks_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/hooks","issue_events_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues/events{/number}","events_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/events","assignees_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/assignees{/user}","branches_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/branches{/branch}","tags_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/tags","blobs_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/statuses/{sha}","languages_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/languages","stargazers_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/stargazers","contributors_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/contributors","subscribers_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/subscribers","subscription_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/subscription","commits_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/contents/{+path}","compare_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/merges","archive_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/downloads","issues_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues{/number}","pulls_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/pulls{/number}","milestones_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/milestones{/number}","notifications_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/labels{/name}","releases_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/releases{/id}","deployments_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/deployments","created_at":"2017-03-29T08:08:35Z","updated_at":"2017-03-29T08:08:37Z","pushed_at":"2017-06-20T14:16:59Z","git_url":"git://github.com/isoos/pub-dartlang-dart.git","ssh_url":"git@github.com:isoos/pub-dartlang-dart.git","clone_url":"https://github.com/isoos/pub-dartlang-dart.git","svn_url":"https://github.com/isoos/pub-dartlang-dart","homepage":"https://pub.dartlang.org/","size":1061,"stargazers_count":0,"watchers_count":0,"language":"Dart","has_issues":false,"has_projects":true,"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":"dart-lang:master","ref":"master","sha":"c4aeb30320142c170728768fb7e1413a61d57839","user":{"login":"dart-lang","id":1609975,"avatar_url":"https://avatars3.githubusercontent.com/u/1609975?v=3","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":28035756,"name":"pub-dartlang-dart","full_name":"dart-lang/pub-dartlang-dart","owner":{"login":"dart-lang","id":1609975,"avatar_url":"https://avatars3.githubusercontent.com/u/1609975?v=3","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dart-lang/pub-dartlang-dart","description":"The pub.dartlang.org site in Dart","fork":false,"url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart","forks_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/forks","keys_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/teams","hooks_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/hooks","issue_events_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/events{/number}","events_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/events","assignees_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/assignees{/user}","branches_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/branches{/branch}","tags_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/tags","blobs_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/statuses/{sha}","languages_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/languages","stargazers_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/stargazers","contributors_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/contributors","subscribers_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/subscribers","subscription_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/subscription","commits_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/contents/{+path}","compare_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/merges","archive_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/downloads","issues_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues{/number}","pulls_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls{/number}","milestones_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/milestones{/number}","notifications_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/labels{/name}","releases_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/releases{/id}","deployments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/deployments","created_at":"2014-12-15T12:29:08Z","updated_at":"2017-05-13T09:37:34Z","pushed_at":"2017-06-20T14:19:48Z","git_url":"git://github.com/dart-lang/pub-dartlang-dart.git","ssh_url":"git@github.com:dart-lang/pub-dartlang-dart.git","clone_url":"https://github.com/dart-lang/pub-dartlang-dart.git","svn_url":"https://github.com/dart-lang/pub-dartlang-dart","homepage":"https://pub.dartlang.org/","size":974,"stargazers_count":15,"watchers_count":15,"language":"Dart","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":16,"forks":8,"open_issues":16,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177"},"html":{"href":"https://github.com/dart-lang/pub-dartlang-dart/pull/177"},"issue":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/177"},"comments":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/177/comments"},"review_comments":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177/comments"},"review_comment":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/177/commits"},"statuses":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/statuses/aa16b084de33080ba855a694d3f7bb9c9187ddfa"}}}}
{"actor":{"display_login":"kevmoo"}}