Re: Pause and Resume

Alexey Zakhlestin <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
On 18.11.13, 16:08, Trans wrote:
> I've been working with YAML streams the last couple of days and I've run
> into an issue/question I could use some help with.
>
> The program I am working on passes a YAML stream through a pipe. At any
> point during the stream the producing program may need to halt the YAML
> stream and somehow instruct the program at the end of the pipe that the
> YAML is "paused". From there it expects the consuming program to dump
> what comes across the pipe to stdout as given until such time it
> receives a special instruction to "resume" processing the YAML stream.
>
> Initially I thought this should be easy, I can just send a `...` to
> signal the pause and a `---` to restart. But this morning I realized,
> though I might be able to get away with in my particular case, it's not
> technically quite right b/c there could be a situation where the pause
> needs to occur mid-document.
>
> So this leads me to wonder, should YAML have markers for pause and
> resume, in addition to the current boundary markers?

This doesn't sound right to me. This is an application-specific task and
should be handled on the level of protocol.

YAML documents -> [Protocol encoding] -> [Transport = Pipe] ->
  -> [Protocol decoding] -> [Receiver]

So, you are looking for some protocol, which allows you to send
control-flow information in addition to data packets.

> Also, are there any standards for this kind of thing when using pipes in
> general? If there are maybe that would be sufficient.

I don't think there's anything specific to pipes (I might be wrong).

The simplest low-level solution is to send data via packets prefixing
them with packet-type (data or control) followed by length of payload
and payload itself.

High-level solution would be to replace pipes by 0mq


-- 
Alexey Zakhlestin
CTO at Grids.by/you
https://github.com/indeyets
PGP key: http://indeyets.ru/alexey.zakhlestin.pgp.asc

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
signature.asc (application/pgp-signature, 495 B)
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQEcBAEBCgAGBQJSigzDAAoJEMkJcRxZdR27zGcH/ip9RXfvYimyRl0madk4nk3d
sTKqw3s7ZpLETJtHof0pK8ssM5r9G39voxV66AbskzZTIYMy5mKnFMp82QN7k0kL
clGBCu5ksL0ViVIh5+4NnOhUt/qm2sBa3nNWupM5V+ex7W8Gxb7wQB7Kd3CM92yD
uAuHq3g/6h6FfEeYO1zwDnLH2cS1GP6j6nnpjIaov64DBFBf7GMwlDnuHPmwtgJj
TG1rj6ZtV66nc4T0KWE90WWi/HGxkFNhaq9BLUPO/sjGIKavepXue03IDYQJ4PIn
/Y63wZnF7w4JjM0yQWjX/yevZQBuzchL7jlKnl9JIbHLZKMPw8i6X8/SclTV1QM=
=RSUh
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.