www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Streaming interfaces

reply "John" <foo foo.com> writes:
I'm toying with writing an apache avro library and it probably 
makes sense to write it to a streaming interface. However, the 
warnings on std.stream / std.c.stream (together with the lack of 
implementations) suggest that's a bad idea.

If I want to provide an interface that does data transformation 
but results in minimal data copying when coming to or from disk, 
network or RAM, where would your recommend I look? I see 
std.container, std.outbuffer, dynamic arrays, and I have little 
sense of how I should expose a public interface.

Thanks for any advice.
Jan 18 2014
next sibling parent reply "Jason White" <54f9byee3t32 gmail.com> writes:
There has been some work on the serialization front:

     http://wiki.dlang.org/Review/std.serialization

I don't think std.serialization can read/write directly from/to a 
socket. It seems to me that a generalized stream interface is 
required to achieve this.

There has also been some work recently on buffered streams (input 
only) that supports minimal data copying:

     "[RFC] I/O and Buffer Range"
     http://forum.dlang.org/thread/l9q66g$2he3$1 digitalmars.com

It's still in early stages, but it looks like a good design so 
far.

In short: There is no good replacement for std.stream yet. You 
might just have to use it in the meantime.
Jan 20 2014
parent Jacob Carlborg <doob me.com> writes:
On 2014-01-21 02:41, Jason White wrote:
 There has been some work on the serialization front:

      http://wiki.dlang.org/Review/std.serialization

 I don't think std.serialization can read/write directly from/to a
 socket. It seems to me that a generalized stream interface is required
 to achieve this.

Currently it cannot. But the idea is that the final implementation will provide a range API. If the socket provides a range API as well, it can read from/to the socket. -- /Jacob Carlborg
Jan 21 2014
prev sibling parent "John" <foo foo.com> writes:
 Jacob,  Jason: Thanks for the feedback. I think I'm going to 
stick with std.stream and retrofit when appropriate.
Jan 21 2014