{"action":"created","issue":{"url":"https://api.github.com/repos/rchain/rchain/issues/1196","repository_url":"https://api.github.com/repos/rchain/rchain","labels_url":"https://api.github.com/repos/rchain/rchain/issues/1196/labels{/name}","comments_url":"https://api.github.com/repos/rchain/rchain/issues/1196/comments","events_url":"https://api.github.com/repos/rchain/rchain/issues/1196/events","html_url":"https://github.com/rchain/rchain/pull/1196","id":345125244,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0MzU0ODIx","number":1196,"title":"CORE-774/CORE-904 Replace MonadState with Cell in TcpTransportLayer","user":{"login":"rabbitonweb","id":6287558,"node_id":"MDQ6VXNlcjYyODc1NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/6287558?v=4","gravatar_id":"","url":"https://api.github.com/users/rabbitonweb","html_url":"https://github.com/rabbitonweb","followers_url":"https://api.github.com/users/rabbitonweb/followers","following_url":"https://api.github.com/users/rabbitonweb/following{/other_user}","gists_url":"https://api.github.com/users/rabbitonweb/gists{/gist_id}","starred_url":"https://api.github.com/users/rabbitonweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rabbitonweb/subscriptions","organizations_url":"https://api.github.com/users/rabbitonweb/orgs","repos_url":"https://api.github.com/users/rabbitonweb/repos","events_url":"https://api.github.com/users/rabbitonweb/events{/privacy}","received_events_url":"https://api.github.com/users/rabbitonweb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-27T07:47:47Z","updated_at":"2018-07-27T17:32:28Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/rchain/rchain/pulls/1196","html_url":"https://github.com/rchain/rchain/pull/1196","diff_url":"https://github.com/rchain/rchain/pull/1196.diff","patch_url":"https://github.com/rchain/rchain/pull/1196.patch"},"body":"\r\n## Overview\r\nPreviously when using `MonadState` we could have race conditions when\r\ncreating or removing grpc connections. Example would be two threads\r\ncalling `connection` function, creating new ManagedConnection and\r\nstoring them to map. During race, only one thread would store its\r\nconnection to map, leaving the other with leaking resources.\r\n\r\nWith Cell we can have thread-safe state modifications while applying\r\neffects (creating connections). This has adventage over using Ref and\r\nits compareAndSet/transform function. While using `Ref` is in general\r\nconsidered better approach (as it is almost non-blocking), it has its\r\nlimits when state modification wants to apply external effect.\r\nCell typeclass does not have this limitation. Cons of using Cell is\r\nthe fact that whole `modify` is a blocking function.\r\n\r\n### Which JIRA issue does this PR relate to? If there is not a JIRA issue addressing this work, please create one now and add the link here.\r\nhttps://rchain.atlassian.net/secure/RapidBoard.jspa?rapidView=7&projectKey=CORE&modal=detail&selectedIssue=CORE-774\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rchain/rchain/issues/comments/408487300","html_url":"https://github.com/rchain/rchain/pull/1196#issuecomment-408487300","issue_url":"https://api.github.com/repos/rchain/rchain/issues/1196","id":408487300,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODQ4NzMwMA==","user":{"login":"goral09","id":5120801,"node_id":"MDQ6VXNlcjUxMjA4MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5120801?v=4","gravatar_id":"","url":"https://api.github.com/users/goral09","html_url":"https://github.com/goral09","followers_url":"https://api.github.com/users/goral09/followers","following_url":"https://api.github.com/users/goral09/following{/other_user}","gists_url":"https://api.github.com/users/goral09/gists{/gist_id}","starred_url":"https://api.github.com/users/goral09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goral09/subscriptions","organizations_url":"https://api.github.com/users/goral09/orgs","repos_url":"https://api.github.com/users/goral09/repos","events_url":"https://api.github.com/users/goral09/events{/privacy}","received_events_url":"https://api.github.com/users/goral09/received_events","type":"User","site_admin":false},"created_at":"2018-07-27T17:32:28Z","updated_at":"2018-07-27T17:32:28Z","author_association":"COLLABORATOR","body":"@rabbitonweb \r\n> While using Ref is in general considered better approach (as it is almost non-blocking), it has its\r\nlimits when state modification wants to apply external effect.\r\n\r\nI got it!\r\n\r\n```scala\r\nval cell: Ref[IO, IO[A]] = …\r\n```\r\nwhich means that the value stored in `Ref` is itself an effect -- in particular it can mean modifying itself :) \r\n"}}
{"actor":{"display_login":"goral09"}}