{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/171497441","pull_request_review_id":100343622,"id":171497441,"diff_hunk":"@@ -0,0 +1,102 @@\n+/**\n+ * Copyright (C) 2016-2018 Lightbend Inc. <http://www.lightbend.com/>\n+ */\n+\n+package akka.persistence.typed.internal\n+\n+import java.util.UUID\n+import java.util.concurrent.atomic.AtomicInteger\n+\n+import akka.actor.NoSerializationVerificationNeeded\n+import akka.actor.typed.Behavior\n+import akka.actor.typed.Behavior.StoppedBehavior\n+import akka.actor.typed.scaladsl.{ ActorContext, TimerScheduler }\n+import akka.annotation.InternalApi\n+import akka.event.{ LogSource, Logging }\n+import akka.persistence.typed.scaladsl.PersistentBehaviors\n+import akka.persistence.{ JournalProtocol, Persistence, RecoveryPermitter, SnapshotProtocol }\n+import akka.{ actor ⇒ a }\n+\n+/** INTERNAL API */\n+@InternalApi\n+private[akka] object EventsourcedBehavior {\n+\n+  // ok to wrap around (2*Int.MaxValue restarts will not happen within a journal roundtrip)\n+  private[akka] val instanceIdCounter = new AtomicInteger(1)\n+\n+  @InternalApi private[akka] object WriterIdentity {\n+    def newIdentity(): WriterIdentity = {\n+      val instanceId: Int = EventsourcedBehavior.instanceIdCounter.getAndIncrement()\n+      val writerUuid: String = UUID.randomUUID.toString\n+      WriterIdentity(instanceId, writerUuid)\n+    }\n+  }\n+  private[akka] final case class WriterIdentity(instanceId: Int, writerUuid: String)\n+\n+  /** Protocol used internally by the eventsourced behaviors, never exposed to user-land */\n+  private[akka] sealed trait EventsourcedProtocol\n+  private[akka] case object RecoveryPermitGranted extends EventsourcedProtocol\n+  private[akka] final case class JournalResponse(msg: akka.persistence.JournalProtocol.Response) extends EventsourcedProtocol\n+  private[akka] final case class SnapshotterResponse(msg: akka.persistence.SnapshotProtocol.Response) extends EventsourcedProtocol\n+  private[akka] final case class RecoveryTickEvent(snapshot: Boolean) extends EventsourcedProtocol\n+  private[akka] final case class ReceiveTimeout(timeout: akka.actor.ReceiveTimeout) extends EventsourcedProtocol\n+\n+  implicit object PersistentBehaviorLogSource extends LogSource[EventsourcedBehavior[_, _, _]] {\n+    override def genString(b: EventsourcedBehavior[_, _, _]): String = {\n+      val behaviorShortName = b match {\n+        case _: EventsourcedRunning[_, _, _]                  ⇒ \"running\"\n+        case _: EventsourcedRecoveringEvents[_, _, _]         ⇒ \"recover-events\"\n+        case _: EventsourcedRecoveringSnapshot[_, _, _]       ⇒ \"recover-snap\"\n+        case _: EventsourcedRequestingRecoveryPermit[_, _, _] ⇒ \"awaiting-permit\"\n+      }\n+      s\"PersistentBehavior[id:${b.persistenceId}][${b.context.self.path}][$behaviorShortName]\"\n+    }\n+  }","path":"akka-persistence-typed/src/main/scala/akka/persistence/typed/internal/EventsourcedBehavior.scala","position":54,"original_position":54,"commit_id":"c84c1b052da0e27bfcdda60fc8f1ef0e349f1dd9","original_commit_id":"c84c1b052da0e27bfcdda60fc8f1ef0e349f1dd9","user":{"login":"johanandren","id":666915,"avatar_url":"https://avatars3.githubusercontent.com/u/666915?v=4","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"body":"Hmm, while neat, is this really needed, can't we just use `ctx.log` rather than separate logging instances in the four behaviors? Maybe put the `id` and `behaviorShortName` in mdc?","created_at":"2018-03-01T09:08:59Z","updated_at":"2018-03-01T09:47:58Z","html_url":"https://github.com/akka/akka/pull/24454#discussion_r171497441","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/24454","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/171497441"},"html":{"href":"https://github.com/akka/akka/pull/24454#discussion_r171497441"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/24454"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/24454","id":166212612,"html_url":"https://github.com/akka/akka/pull/24454","diff_url":"https://github.com/akka/akka/pull/24454.diff","patch_url":"https://github.com/akka/akka/pull/24454.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/24454","number":24454,"state":"open","locked":false,"title":"Native Typed Persistence Behavior Implementation - NTPBI","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars1.githubusercontent.com/u/120979?v=4","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":"Aims to resolve https://github.com/akka/akka/issues/23694\r\n\r\nThis is still WIP and needs more cleanup, but only the last bits remain","created_at":"2018-01-31T09:57:42Z","updated_at":"2018-03-01T09:47:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"780aee1335914a9fa84e31e79591b6f2d936a207","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":37797347,"url":"https://api.github.com/repos/akka/akka/labels/tested","name":"tested","color":"d7e102","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/24454/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/24454/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/24454/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/c84c1b052da0e27bfcdda60fc8f1ef0e349f1dd9","head":{"label":"ktoso:wip-persistence-typed-impl-ktoso","ref":"wip-persistence-typed-impl-ktoso","sha":"c84c1b052da0e27bfcdda60fc8f1ef0e349f1dd9","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars1.githubusercontent.com/u/120979?v=4","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"repo":{"id":4462204,"name":"akka","full_name":"ktoso/akka","owner":{"login":"ktoso","id":120979,"avatar_url":"https://avatars1.githubusercontent.com/u/120979?v=4","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ktoso/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/ktoso/akka","forks_url":"https://api.github.com/repos/ktoso/akka/forks","keys_url":"https://api.github.com/repos/ktoso/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ktoso/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ktoso/akka/teams","hooks_url":"https://api.github.com/repos/ktoso/akka/hooks","issue_events_url":"https://api.github.com/repos/ktoso/akka/issues/events{/number}","events_url":"https://api.github.com/repos/ktoso/akka/events","assignees_url":"https://api.github.com/repos/ktoso/akka/assignees{/user}","branches_url":"https://api.github.com/repos/ktoso/akka/branches{/branch}","tags_url":"https://api.github.com/repos/ktoso/akka/tags","blobs_url":"https://api.github.com/repos/ktoso/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ktoso/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ktoso/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/ktoso/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ktoso/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/ktoso/akka/languages","stargazers_url":"https://api.github.com/repos/ktoso/akka/stargazers","contributors_url":"https://api.github.com/repos/ktoso/akka/contributors","subscribers_url":"https://api.github.com/repos/ktoso/akka/subscribers","subscription_url":"https://api.github.com/repos/ktoso/akka/subscription","commits_url":"https://api.github.com/repos/ktoso/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/ktoso/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/ktoso/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/ktoso/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/ktoso/akka/contents/{+path}","compare_url":"https://api.github.com/repos/ktoso/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ktoso/akka/merges","archive_url":"https://api.github.com/repos/ktoso/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ktoso/akka/downloads","issues_url":"https://api.github.com/repos/ktoso/akka/issues{/number}","pulls_url":"https://api.github.com/repos/ktoso/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/ktoso/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/ktoso/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ktoso/akka/labels{/name}","releases_url":"https://api.github.com/repos/ktoso/akka/releases{/id}","deployments_url":"https://api.github.com/repos/ktoso/akka/deployments","created_at":"2012-05-27T14:05:17Z","updated_at":"2016-10-24T14:59:20Z","pushed_at":"2018-03-01T06:16:49Z","git_url":"git://github.com/ktoso/akka.git","ssh_url":"git@github.com:ktoso/akka.git","clone_url":"https://github.com/ktoso/akka.git","svn_url":"https://github.com/ktoso/akka","homepage":"http://akka.io","size":214356,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"b7cc50cdd6d3e899d8c44d0d5b2597d795200207","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Build highly concurrent, distributed, and resilient message-driven applications on the JVM","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2018-03-01T08:49:35Z","pushed_at":"2018-03-01T08:25:11Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":208167,"stargazers_count":8236,"watchers_count":8236,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2624,"mirror_url":null,"archived":false,"open_issues_count":647,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2624,"open_issues":647,"watchers":8236,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/24454"},"html":{"href":"https://github.com/akka/akka/pull/24454"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/24454"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/24454/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/24454/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/24454/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/c84c1b052da0e27bfcdda60fc8f1ef0e349f1dd9"}},"author_association":"OWNER"}}
{"actor":{"display_login":"johanandren"}}