Hi, I started working again on #3373: http://projects.reductivelabs.com/issues/3373
I'd like to discuss here how to achieve the file client streaming (ie never fully buffer the file content). What makes thing real complex is that the response is valid only in the block of the network request: <pseudo-code> http.get(...) do |response| ... here response is accessible by chunk end ... response is not accessible unless the request was buffered in RAM ... which is not what we want to achieve. </pseudo-code> In the current version, the file content indirector REST call is done when something tries to access the File source property content attribute. This is called by the content property at the time of syncing the type. So, we either need to reverse how the content writing works (passing done a block), or use dirty thread tricks like I did to defer the http request to when we'll actually write content to disk, because we have to pass a block (which will be called with the response chunk) that will have to write the content to disk. My current implementation solves the issue by firing a new thread that waits the file type is ready to write something to the disk and then handles response chunk to the writer thread. It works, but is quite dirty (and I'm sure everybody was offensed by this hardcore code to the point everybody was speechless :-)). For reference see DeferredResponse in [1] So, I'm seeking advice on how to write this code better, and will welcome any comments or ideas. If you need a reference to the actual patch see here: [1] http://github.com/masterzen/puppet/tree/tickets/master/3373 -- Brice Figureau My Blog: http://www.masterzen.fr/ -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
