{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/streams/issues/318","labels_url":"https://api.github.com/repos/whatwg/streams/issues/318/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/streams/issues/318/comments","events_url":"https://api.github.com/repos/whatwg/streams/issues/318/events","html_url":"https://github.com/whatwg/streams/issues/318","id":67001555,"number":318,"title":"Port precise flow control to writable streams","user":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/whatwg/streams/labels/writable%20streams","name":"writable streams","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/whatwg/streams/milestones/7","html_url":"https://github.com/whatwg/streams/milestones/Week%20of%202015-08-24","labels_url":"https://api.github.com/repos/whatwg/streams/milestones/7/labels","id":1265245,"number":7,"title":"Week of 2015-08-24","description":"","creator":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-08-20T20:14:40Z","updated_at":"2015-08-20T20:15:59Z","due_on":"2015-08-28T04:00:00Z","closed_at":null},"comments":3,"created_at":"2015-04-07T22:10:30Z","updated_at":"2015-08-24T09:35:24Z","closed_at":null,"body":"After https://github.com/whatwg/streams/pull/317, readable streams will have precise flow control. We should add something similar to writable streams. However, the shape of it will likely depend on the resolution of https://github.com/whatwg/streams/issues/316."},"comment":{"url":"https://api.github.com/repos/whatwg/streams/issues/comments/134111089","html_url":"https://github.com/whatwg/streams/issues/318#issuecomment-134111089","issue_url":"https://api.github.com/repos/whatwg/streams/issues/318","id":134111089,"user":{"login":"tyoshino","id":4511440,"avatar_url":"https://avatars.githubusercontent.com/u/4511440?v=3","gravatar_id":"","url":"https://api.github.com/users/tyoshino","html_url":"https://github.com/tyoshino","followers_url":"https://api.github.com/users/tyoshino/followers","following_url":"https://api.github.com/users/tyoshino/following{/other_user}","gists_url":"https://api.github.com/users/tyoshino/gists{/gist_id}","starred_url":"https://api.github.com/users/tyoshino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyoshino/subscriptions","organizations_url":"https://api.github.com/users/tyoshino/orgs","repos_url":"https://api.github.com/users/tyoshino/repos","events_url":"https://api.github.com/users/tyoshino/events{/privacy}","received_events_url":"https://api.github.com/users/tyoshino/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T09:35:24Z","updated_at":"2015-08-24T09:35:24Z","body":"> How should the ready signal work?\r\n\r\n`waitForDesiredSize(n)` is useful when the producer know that the stream will have a space >= n. Given a stream but without high water mark value, a producer cannot determine what n would work (don't wait forever) for the stream. I think we need to make n optional and then `waitForDesiredSize(undefined)` work as `waitForDesiredSizeChange/Increase()`. I.e. equiv of (3), (4). I think it would work like the following:\r\n- when `.waitForDesiredSize(undefined)` is called, the writer remembers current space available for write\r\n- when it changes/increases compared to the saved value, resolve the promise.\r\n- and then, the producer checks `desiredSize` and produce appropriate size of data and write it.\r\n- seems \"change\" should be \"change to different value than the saved && the new value is positive\", and \"increase\" should be \"increase to a value more than the saved && positive\". But not sure. A producer may want to target some value more than the stream expects for some reason. I.e. it may want to get notified even when the desiredSize is not yet positive.\r\n"}}