{"action":"created","comment":{"url":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/23447320","id":23447320,"diff_hunk":"@@ -224,35 +227,57 @@ int main(int argc, char* argv[]) {\n   std::unique_ptr<libevent::EventPumpThread> pump(\n       new libevent::EventPumpThread(event_base));\n \n-  // TODO(alcutter): Note that we're currently broken wrt to restarting the\n-  // log server when there's data in the log.  It's a temporary thing though,\n-  // so fear ye not.\n-  FakeEtcdClient etcd_client(event_base);\n+  const bool stand_alone_mode(FLAGS_etcd_host.empty());\n+\n+  LOG(INFO) << \"Running in \"\n+            << (stand_alone_mode ? \"STAND-ALONE\" : \"CLUSTERED\") << \" mode.\";\n+\n+  std::unique_ptr<EtcdClient> etcd_client(\n+      stand_alone_mode\n+          ? new FakeEtcdClient(event_base)\n+          : new EtcdClient(event_base, FLAGS_etcd_host, FLAGS_etcd_port));\n \n   // For now, run with a dedicated thread pool as the executor for our\n   // consistent store to avoid the possibility of DoS through thread starvation\n   // via HTTP.\n   ThreadPool internal_pool(4);\n   EtcdConsistentStore<LoggedCertificate> consistent_store(&internal_pool,\n-                                                          &etcd_client,\n+                                                          etcd_client.get(),\n                                                           \"/root\", node_id);\n-  // Put a sensible single-node config into FakeEtcd. For a real clustered log\n-  // we'd expect a ClusterConfig already to be present within etcd as part of\n-  // the provisioning of the log.\n-  {\n+\n+  TreeSigner<LoggedCertificate> tree_signer(std::chrono::duration<double>(\n+                                                FLAGS_guard_window_seconds),\n+                                            db, &consistent_store,\n+                                            &log_signer);\n+\n+  if (stand_alone_mode) {\n+    // Set up a simple single-node environment.\n+    //\n+    // Put a sensible single-node config into FakeEtcd. For a real clustered\n+    // log\n+    // we'd expect a ClusterConfig already to be present within etcd as part of\n+    // the provisioning of the log.\n+    //\n+    // TODO(alcutter): Note that we're currently broken wrt to restarting the\n+    // log server when there's data in the log.  It's a temporary thing though,\n+    // so fear ye not.\n     ct::ClusterConfig config;\n     config.set_minimum_serving_nodes(1);\n     config.set_minimum_serving_fraction(1);\n     LOG(INFO) << \"Setting default single-node ClusterConfig:\\n\"\n               << config.DebugString();\n     consistent_store.SetClusterConfig(config);\n+\n+    // Do an initial signing run to get the initial STH, again this is\n+    // temporary until we re-populate FakeEtcd from the DB:\n+    CHECK_EQ(tree_signer.UpdateTree(), TreeSigner<LoggedCertificate>::OK);","path":"cpp/server/ct-server.cc","position":84,"original_position":84,"commit_id":"6f37d39d0a7e7a27627a1e9e7154559933323f39","original_commit_id":"6f37d39d0a7e7a27627a1e9e7154559933323f39","user":{"login":"pphaneuf","id":40400,"avatar_url":"https://avatars.githubusercontent.com/u/40400?v=3","gravatar_id":"","url":"https://api.github.com/users/pphaneuf","html_url":"https://github.com/pphaneuf","followers_url":"https://api.github.com/users/pphaneuf/followers","following_url":"https://api.github.com/users/pphaneuf/following{/other_user}","gists_url":"https://api.github.com/users/pphaneuf/gists{/gist_id}","starred_url":"https://api.github.com/users/pphaneuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pphaneuf/subscriptions","organizations_url":"https://api.github.com/users/pphaneuf/orgs","repos_url":"https://api.github.com/users/pphaneuf/repos","events_url":"https://api.github.com/users/pphaneuf/events{/privacy}","received_events_url":"https://api.github.com/users/pphaneuf/received_events","type":"User","site_admin":false},"body":"Thanks!","created_at":"2015-01-23T12:43:09Z","updated_at":"2015-01-23T12:43:09Z","html_url":"https://github.com/google/certificate-transparency/pull/438#discussion_r23447320","pull_request_url":"https://api.github.com/repos/google/certificate-transparency/pulls/438","_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/23447320"},"html":{"href":"https://github.com/google/certificate-transparency/pull/438#discussion_r23447320"},"pull_request":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/438"}}},"pull_request":{"url":"https://api.github.com/repos/google/certificate-transparency/pulls/438","id":27920847,"html_url":"https://github.com/google/certificate-transparency/pull/438","diff_url":"https://github.com/google/certificate-transparency/pull/438.diff","patch_url":"https://github.com/google/certificate-transparency/pull/438.patch","issue_url":"https://api.github.com/repos/google/certificate-transparency/issues/438","number":438,"state":"open","locked":false,"title":"Allow running in stand-alone (FakeEtcd) or Clustered (Etcd) mode","user":{"login":"AlCutter","id":7648032,"avatar_url":"https://avatars.githubusercontent.com/u/7648032?v=3","gravatar_id":"","url":"https://api.github.com/users/AlCutter","html_url":"https://github.com/AlCutter","followers_url":"https://api.github.com/users/AlCutter/followers","following_url":"https://api.github.com/users/AlCutter/following{/other_user}","gists_url":"https://api.github.com/users/AlCutter/gists{/gist_id}","starred_url":"https://api.github.com/users/AlCutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlCutter/subscriptions","organizations_url":"https://api.github.com/users/AlCutter/orgs","repos_url":"https://api.github.com/users/AlCutter/repos","events_url":"https://api.github.com/users/AlCutter/events{/privacy}","received_events_url":"https://api.github.com/users/AlCutter/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-23T12:39:32Z","updated_at":"2015-01-23T12:43:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b36935ad827c7709e1ae93b94bcc5c67fbfd157b","assignee":{"login":"pphaneuf","id":40400,"avatar_url":"https://avatars.githubusercontent.com/u/40400?v=3","gravatar_id":"","url":"https://api.github.com/users/pphaneuf","html_url":"https://github.com/pphaneuf","followers_url":"https://api.github.com/users/pphaneuf/followers","following_url":"https://api.github.com/users/pphaneuf/following{/other_user}","gists_url":"https://api.github.com/users/pphaneuf/gists{/gist_id}","starred_url":"https://api.github.com/users/pphaneuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pphaneuf/subscriptions","organizations_url":"https://api.github.com/users/pphaneuf/orgs","repos_url":"https://api.github.com/users/pphaneuf/repos","events_url":"https://api.github.com/users/pphaneuf/events{/privacy}","received_events_url":"https://api.github.com/users/pphaneuf/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/google/certificate-transparency/pulls/438/commits","review_comments_url":"https://api.github.com/repos/google/certificate-transparency/pulls/438/comments","review_comment_url":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/{number}","comments_url":"https://api.github.com/repos/google/certificate-transparency/issues/438/comments","statuses_url":"https://api.github.com/repos/google/certificate-transparency/statuses/6f37d39d0a7e7a27627a1e9e7154559933323f39","head":{"label":"AlCutter:standalone_or_clustered","ref":"standalone_or_clustered","sha":"6f37d39d0a7e7a27627a1e9e7154559933323f39","user":{"login":"AlCutter","id":7648032,"avatar_url":"https://avatars.githubusercontent.com/u/7648032?v=3","gravatar_id":"","url":"https://api.github.com/users/AlCutter","html_url":"https://github.com/AlCutter","followers_url":"https://api.github.com/users/AlCutter/followers","following_url":"https://api.github.com/users/AlCutter/following{/other_user}","gists_url":"https://api.github.com/users/AlCutter/gists{/gist_id}","starred_url":"https://api.github.com/users/AlCutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlCutter/subscriptions","organizations_url":"https://api.github.com/users/AlCutter/orgs","repos_url":"https://api.github.com/users/AlCutter/repos","events_url":"https://api.github.com/users/AlCutter/events{/privacy}","received_events_url":"https://api.github.com/users/AlCutter/received_events","type":"User","site_admin":false},"repo":{"id":23961092,"name":"certificate-transparency","full_name":"AlCutter/certificate-transparency","owner":{"login":"AlCutter","id":7648032,"avatar_url":"https://avatars.githubusercontent.com/u/7648032?v=3","gravatar_id":"","url":"https://api.github.com/users/AlCutter","html_url":"https://github.com/AlCutter","followers_url":"https://api.github.com/users/AlCutter/followers","following_url":"https://api.github.com/users/AlCutter/following{/other_user}","gists_url":"https://api.github.com/users/AlCutter/gists{/gist_id}","starred_url":"https://api.github.com/users/AlCutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlCutter/subscriptions","organizations_url":"https://api.github.com/users/AlCutter/orgs","repos_url":"https://api.github.com/users/AlCutter/repos","events_url":"https://api.github.com/users/AlCutter/events{/privacy}","received_events_url":"https://api.github.com/users/AlCutter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlCutter/certificate-transparency","description":"Auditing for TLS certificates.","fork":true,"url":"https://api.github.com/repos/AlCutter/certificate-transparency","forks_url":"https://api.github.com/repos/AlCutter/certificate-transparency/forks","keys_url":"https://api.github.com/repos/AlCutter/certificate-transparency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlCutter/certificate-transparency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlCutter/certificate-transparency/teams","hooks_url":"https://api.github.com/repos/AlCutter/certificate-transparency/hooks","issue_events_url":"https://api.github.com/repos/AlCutter/certificate-transparency/issues/events{/number}","events_url":"https://api.github.com/repos/AlCutter/certificate-transparency/events","assignees_url":"https://api.github.com/repos/AlCutter/certificate-transparency/assignees{/user}","branches_url":"https://api.github.com/repos/AlCutter/certificate-transparency/branches{/branch}","tags_url":"https://api.github.com/repos/AlCutter/certificate-transparency/tags","blobs_url":"https://api.github.com/repos/AlCutter/certificate-transparency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlCutter/certificate-transparency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlCutter/certificate-transparency/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlCutter/certificate-transparency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlCutter/certificate-transparency/statuses/{sha}","languages_url":"https://api.github.com/repos/AlCutter/certificate-transparency/languages","stargazers_url":"https://api.github.com/repos/AlCutter/certificate-transparency/stargazers","contributors_url":"https://api.github.com/repos/AlCutter/certificate-transparency/contributors","subscribers_url":"https://api.github.com/repos/AlCutter/certificate-transparency/subscribers","subscription_url":"https://api.github.com/repos/AlCutter/certificate-transparency/subscription","commits_url":"https://api.github.com/repos/AlCutter/certificate-transparency/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlCutter/certificate-transparency/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlCutter/certificate-transparency/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlCutter/certificate-transparency/issues/comments/{number}","contents_url":"https://api.github.com/repos/AlCutter/certificate-transparency/contents/{+path}","compare_url":"https://api.github.com/repos/AlCutter/certificate-transparency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlCutter/certificate-transparency/merges","archive_url":"https://api.github.com/repos/AlCutter/certificate-transparency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlCutter/certificate-transparency/downloads","issues_url":"https://api.github.com/repos/AlCutter/certificate-transparency/issues{/number}","pulls_url":"https://api.github.com/repos/AlCutter/certificate-transparency/pulls{/number}","milestones_url":"https://api.github.com/repos/AlCutter/certificate-transparency/milestones{/number}","notifications_url":"https://api.github.com/repos/AlCutter/certificate-transparency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlCutter/certificate-transparency/labels{/name}","releases_url":"https://api.github.com/repos/AlCutter/certificate-transparency/releases{/id}","created_at":"2014-09-12T13:11:02Z","updated_at":"2014-11-27T12:57:17Z","pushed_at":"2015-01-23T12:42:22Z","git_url":"git://github.com/AlCutter/certificate-transparency.git","ssh_url":"git@github.com:AlCutter/certificate-transparency.git","clone_url":"https://github.com/AlCutter/certificate-transparency.git","svn_url":"https://github.com/AlCutter/certificate-transparency","homepage":"http://www.certificate-transparency.org/","size":18401,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"google:super_duper","ref":"super_duper","sha":"cc673e9c3e76ecba1704c9dc4145ff842cdf2ce5","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19989605,"name":"certificate-transparency","full_name":"google/certificate-transparency","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/certificate-transparency","description":"Auditing for TLS certificates.","fork":false,"url":"https://api.github.com/repos/google/certificate-transparency","forks_url":"https://api.github.com/repos/google/certificate-transparency/forks","keys_url":"https://api.github.com/repos/google/certificate-transparency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/certificate-transparency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/certificate-transparency/teams","hooks_url":"https://api.github.com/repos/google/certificate-transparency/hooks","issue_events_url":"https://api.github.com/repos/google/certificate-transparency/issues/events{/number}","events_url":"https://api.github.com/repos/google/certificate-transparency/events","assignees_url":"https://api.github.com/repos/google/certificate-transparency/assignees{/user}","branches_url":"https://api.github.com/repos/google/certificate-transparency/branches{/branch}","tags_url":"https://api.github.com/repos/google/certificate-transparency/tags","blobs_url":"https://api.github.com/repos/google/certificate-transparency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/certificate-transparency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/certificate-transparency/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/certificate-transparency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/certificate-transparency/statuses/{sha}","languages_url":"https://api.github.com/repos/google/certificate-transparency/languages","stargazers_url":"https://api.github.com/repos/google/certificate-transparency/stargazers","contributors_url":"https://api.github.com/repos/google/certificate-transparency/contributors","subscribers_url":"https://api.github.com/repos/google/certificate-transparency/subscribers","subscription_url":"https://api.github.com/repos/google/certificate-transparency/subscription","commits_url":"https://api.github.com/repos/google/certificate-transparency/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/certificate-transparency/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/certificate-transparency/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/certificate-transparency/issues/comments/{number}","contents_url":"https://api.github.com/repos/google/certificate-transparency/contents/{+path}","compare_url":"https://api.github.com/repos/google/certificate-transparency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/certificate-transparency/merges","archive_url":"https://api.github.com/repos/google/certificate-transparency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/certificate-transparency/downloads","issues_url":"https://api.github.com/repos/google/certificate-transparency/issues{/number}","pulls_url":"https://api.github.com/repos/google/certificate-transparency/pulls{/number}","milestones_url":"https://api.github.com/repos/google/certificate-transparency/milestones{/number}","notifications_url":"https://api.github.com/repos/google/certificate-transparency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/certificate-transparency/labels{/name}","releases_url":"https://api.github.com/repos/google/certificate-transparency/releases{/id}","created_at":"2014-05-20T17:03:47Z","updated_at":"2015-01-22T21:28:25Z","pushed_at":"2015-01-22T18:13:40Z","git_url":"git://github.com/google/certificate-transparency.git","ssh_url":"git@github.com:google/certificate-transparency.git","clone_url":"https://github.com/google/certificate-transparency.git","svn_url":"https://github.com/google/certificate-transparency","homepage":"http://www.certificate-transparency.org/","size":21749,"stargazers_count":82,"watchers_count":82,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":42,"forks":30,"open_issues":42,"watchers":82,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/438"},"html":{"href":"https://github.com/google/certificate-transparency/pull/438"},"issue":{"href":"https://api.github.com/repos/google/certificate-transparency/issues/438"},"comments":{"href":"https://api.github.com/repos/google/certificate-transparency/issues/438/comments"},"review_comments":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/438/comments"},"review_comment":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/438/commits"},"statuses":{"href":"https://api.github.com/repos/google/certificate-transparency/statuses/6f37d39d0a7e7a27627a1e9e7154559933323f39"}}}}