{"action":"created","issue":{"url":"https://api.github.com/repos/netty/netty/issues/3969","labels_url":"https://api.github.com/repos/netty/netty/issues/3969/labels{/name}","comments_url":"https://api.github.com/repos/netty/netty/issues/3969/comments","events_url":"https://api.github.com/repos/netty/netty/issues/3969/events","html_url":"https://github.com/netty/netty/pull/3969","id":94153432,"number":3969,"title":"(POC) Refactor FileRegion to implement new ReadableObject API","user":{"login":"nmittler","id":6493296,"avatar_url":"https://avatars.githubusercontent.com/u/6493296?v=3","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"nmittler","id":6493296,"avatar_url":"https://avatars.githubusercontent.com/u/6493296?v=3","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/netty/netty/milestones/117","html_url":"https://github.com/netty/netty/milestones/4.1.0.Beta6","labels_url":"https://api.github.com/repos/netty/netty/milestones/117/labels","id":1100817,"number":117,"title":"4.1.0.Beta6","description":"","creator":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars.githubusercontent.com/u/439362?v=3","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"open_issues":73,"closed_issues":75,"state":"open","created_at":"2015-05-07T19:29:09Z","updated_at":"2015-08-20T17:10:24Z","due_on":null,"closed_at":null},"comments":49,"created_at":"2015-07-09T21:14:54Z","updated_at":"2015-08-20T18:08:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/3969","html_url":"https://github.com/netty/netty/pull/3969","diff_url":"https://github.com/netty/netty/pull/3969.diff","patch_url":"https://github.com/netty/netty/pull/3969.patch"},"body":"Motivation:\r\n\r\nBased on #3965. As a first step of integrating the unified reading API, the low-hanging fruit is to refactor `FIleRegion` to use it.\r\n\r\nModifications:\r\n\r\nRefactored `FileRegion` to extend `ReadableObject` and implemented the new interface in `DefaultFileRegion`.\r\n\r\nResult:\r\n\r\n`FileRegion` implements the new `ReadableObject` interface."},"comment":{"url":"https://api.github.com/repos/netty/netty/issues/comments/133103377","html_url":"https://github.com/netty/netty/pull/3969#issuecomment-133103377","issue_url":"https://api.github.com/repos/netty/netty/issues/3969","id":133103377,"user":{"login":"nmittler","id":6493296,"avatar_url":"https://avatars.githubusercontent.com/u/6493296?v=3","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T18:08:16Z","updated_at":"2015-08-20T18:08:16Z","body":"I was just chatting with @louiscryan offline and we have an idea which may help to get past this.  The core part of the idea is that the only part of the system that needs `long` indices is when we actually go to write the `FileRegion`.  The idea is this:\r\n\r\n1) Change `ReadableObject` to use `int` positions.\r\n2) `FileRegion` will no longer implement `ReadableObject`.\r\n3) Allow `FileRegion` to be sliced into a sequence of `FileRegionSlice`s, which only hold int-based positions and implement `ReadableObject`.\r\n4) `PendingWriteQueue` will only take `ReadableObject`s as input, but when data is read out of it, any contiguous `FileRegionSlice`s (for the same `FileRegion) will be merged into a new `FileRegion`.  Note that this will only need to happen if a merge is needed (i.e. > 1 mergeable `FileRegionSlice`s in a row), \r\n\r\nUnfortunately this means that when we go to do the actual write, we'll still need separate logic for handling `FileRegion` and `ReadableObject`, but maybe that's just a necessary evil.\r\n\r\nWhat do you guys think?"}}