RE: svn commit: r40378 - in trunk/subversion: include libsvn_subr tests/libsvn_subr

View: New views
5 Messages — Rating Filter:   Alert me  

Parent Message unknown RE: svn commit: r40378 - in trunk/subversion: include libsvn_subr tests/libsvn_subr

by Bert Huijben-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> -----Original Message-----
> From: Hyrum K. Wright [mailto:hyrum@...]
> Sent: donderdag 5 november 2009 5:00
> To: svn@...
> Subject: svn commit: r40378 - in trunk/subversion: include libsvn_subr
> tests/libsvn_subr
>
> Author: hwright
> Date: Wed Nov  4 20:00:08 2009
> New Revision: 40378
>
> Log:
> Add a duplication facility to our stream toolbox.  Along the lines of
> the tee(1), the new svn_stream_tee() function returns a stream which,
> when
> written to, writes to both of the underlying streams.  This allows
> writing
> two files simultaneously, or writing a file while also pushing content
> across the network.
>
> This isn't used directly by this commit, but I envision a couple of
> uses down
> the road.  In any case, it's a potentially useful tool, and a nice
> exercise while stuck in an aluminum tube.
>
> * subversion/libsvn_subr/stream.c
>   (baton_tee, write_handler_tee, svn_stream_tee): New.

I think it would be useful to add a close handler, to allow closing the inner streams via the outer stream.

In libsvn_wc/adm_crawler.c there is a variant of this stream code. It writes all bytes that are read from another stream. (Search for copying_stream). It would be nice if we could combine these into one generic feature. (But currently I don't see how)

        Bert

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414637

Re: svn commit: r40378 - in trunk/subversion: include libsvn_subr tests/libsvn_subr

by Daniel Rall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 5, 2009 at 12:33 AM, Bert Huijben <rhuijben@...> wrote:

>> -----Original Message-----
>> From: Hyrum K. Wright [mailto:hyrum@...]
>> Sent: donderdag 5 november 2009 5:00
>> To: svn@...
>> Subject: svn commit: r40378 - in trunk/subversion: include libsvn_subr
>> tests/libsvn_subr
>>
>> Author: hwright
>> Date: Wed Nov  4 20:00:08 2009
>> New Revision: 40378
>>
>> Log:
>> Add a duplication facility to our stream toolbox.  Along the lines of
>> the tee(1), the new svn_stream_tee() function returns a stream which,
>> when
>> written to, writes to both of the underlying streams.  This allows
>> writing
>> two files simultaneously, or writing a file while also pushing content
>> across the network.
>>
>> This isn't used directly by this commit, but I envision a couple of
>> uses down
>> the road.  In any case, it's a potentially useful tool, and a nice
>> exercise while stuck in an aluminum tube.
>>
>> * subversion/libsvn_subr/stream.c
>>   (baton_tee, write_handler_tee, svn_stream_tee): New.
>
> I think it would be useful to add a close handler, to allow closing the inner streams via the outer stream.
>
> In libsvn_wc/adm_crawler.c there is a variant of this stream code. It writes all bytes that are read from another stream. (Search for copying_stream). It would be nice if we could combine these into one generic feature. (But currently I don't see how)

How about allowing for a sentinel value (e.g. NULL) for one of the
output streams, turning the tee into pipe?

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414959

Re: svn commit: r40378 - in trunk/subversion: include libsvn_subr tests/libsvn_subr

by Hyrum K. Wright-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 5, 2009, at 2:33 AM, Bert Huijben wrote:

>> -----Original Message-----
>> From: Hyrum K. Wright [mailto:hyrum@...]
>> Sent: donderdag 5 november 2009 5:00
>> To: svn@...
>> Subject: svn commit: r40378 - in trunk/subversion: include  
>> libsvn_subr
>> tests/libsvn_subr
>>
>> Author: hwright
>> Date: Wed Nov  4 20:00:08 2009
>> New Revision: 40378
>>
>> Log:
>> Add a duplication facility to our stream toolbox.  Along the lines of
>> the tee(1), the new svn_stream_tee() function returns a stream which,
>> when
>> written to, writes to both of the underlying streams.  This allows
>> writing
>> two files simultaneously, or writing a file while also pushing  
>> content
>> across the network.
>>
>> This isn't used directly by this commit, but I envision a couple of
>> uses down
>> the road.  In any case, it's a potentially useful tool, and a nice
>> exercise while stuck in an aluminum tube.
>>
>> * subversion/libsvn_subr/stream.c
>>  (baton_tee, write_handler_tee, svn_stream_tee): New.
>
> I think it would be useful to add a close handler, to allow closing  
> the inner streams via the outer stream.

Thanks for catching this.  It was the initial intent, and even  
documented as such, just not implemented.  See r40432.

> In libsvn_wc/adm_crawler.c there is a variant of this stream code.  
> It writes all bytes that are read from another stream. (Search for  
> copying_stream). It would be nice if we could combine these into one  
> generic feature. (But currently I don't see how)

Yes, that would be nice.  Looking at the implementation, it's kinda  
like tee, only it's pull-driven instead of push-driven.  I wonder how  
we could integrate them...

-Hyrum

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415826

Re: svn commit: r40378 - in trunk/subversion: include libsvn_subr tests/libsvn_subr

by Hyrum K. Wright-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 5, 2009, at 6:53 PM, Daniel Rall wrote:

> On Thu, Nov 5, 2009 at 12:33 AM, Bert Huijben  
> <rhuijben@...> wrote:
>>> -----Original Message-----
>>> From: Hyrum K. Wright [mailto:hyrum@...]
>>> Sent: donderdag 5 november 2009 5:00
>>> To: svn@...
>>> Subject: svn commit: r40378 - in trunk/subversion: include  
>>> libsvn_subr
>>> tests/libsvn_subr
>>>
>>> Author: hwright
>>> Date: Wed Nov  4 20:00:08 2009
>>> New Revision: 40378
>>>
>>> Log:
>>> Add a duplication facility to our stream toolbox.  Along the lines  
>>> of
>>> the tee(1), the new svn_stream_tee() function returns a stream  
>>> which,
>>> when
>>> written to, writes to both of the underlying streams.  This allows
>>> writing
>>> two files simultaneously, or writing a file while also pushing  
>>> content
>>> across the network.
>>>
>>> This isn't used directly by this commit, but I envision a couple of
>>> uses down
>>> the road.  In any case, it's a potentially useful tool, and a nice
>>> exercise while stuck in an aluminum tube.
>>>
>>> * subversion/libsvn_subr/stream.c
>>>   (baton_tee, write_handler_tee, svn_stream_tee): New.
>>
>> I think it would be useful to add a close handler, to allow closing  
>> the inner streams via the outer stream.
>>
>> In libsvn_wc/adm_crawler.c there is a variant of this stream code.  
>> It writes all bytes that are read from another stream. (Search for  
>> copying_stream). It would be nice if we could combine these into  
>> one generic feature. (But currently I don't see how)
>
> How about allowing for a sentinel value (e.g. NULL) for one of the
> output streams, turning the tee into pipe?

I believe that's what the docs say, and what the current  
implementation already does:


   if (out1 == NULL)
     return out2;

   if (out2 == NULL)
     return out1;


Lemme know if I'm missing something.

-Hyrum

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415827

Re: svn commit: r40378 - in trunk/subversion: include libsvn_subr tests/libsvn_subr

by Daniel Rall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 9, 2009 at 8:04 AM, Hyrum K. Wright
<hyrum_wright@...> wrote:

>
> On Nov 5, 2009, at 6:53 PM, Daniel Rall wrote:
>
>> On Thu, Nov 5, 2009 at 12:33 AM, Bert Huijben <rhuijben@...>
>> wrote:
>>>>
>>>> -----Original Message-----
>>>> From: Hyrum K. Wright [mailto:hyrum@...]
>>>> Sent: donderdag 5 november 2009 5:00
>>>> To: svn@...
>>>> Subject: svn commit: r40378 - in trunk/subversion: include libsvn_subr
>>>> tests/libsvn_subr
>>>>
>>>> Author: hwright
>>>> Date: Wed Nov  4 20:00:08 2009
>>>> New Revision: 40378
>>>>
>>>> Log:
>>>> Add a duplication facility to our stream toolbox.  Along the lines of
>>>> the tee(1), the new svn_stream_tee() function returns a stream which,
>>>> when
>>>> written to, writes to both of the underlying streams.  This allows
>>>> writing
>>>> two files simultaneously, or writing a file while also pushing content
>>>> across the network.
>>>>
>>>> This isn't used directly by this commit, but I envision a couple of
>>>> uses down
>>>> the road.  In any case, it's a potentially useful tool, and a nice
>>>> exercise while stuck in an aluminum tube.
>>>>
>>>> * subversion/libsvn_subr/stream.c
>>>>  (baton_tee, write_handler_tee, svn_stream_tee): New.
>>>
>>> I think it would be useful to add a close handler, to allow closing the
>>> inner streams via the outer stream.
>>>
>>> In libsvn_wc/adm_crawler.c there is a variant of this stream code. It
>>> writes all bytes that are read from another stream. (Search for
>>> copying_stream). It would be nice if we could combine these into one generic
>>> feature. (But currently I don't see how)
>>
>> How about allowing for a sentinel value (e.g. NULL) for one of the
>> output streams, turning the tee into pipe?
>
> I believe that's what the docs say, and what the current implementation
> already does:
>
>
>  if (out1 == NULL)
>    return out2;
>
>  if (out2 == NULL)
>    return out1;
>
>
> Lemme know if I'm missing something.

Meta-comment; didn't examine the implementation on this one.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415841