Re: Pause and Resume
Oren Ben-Kiki <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CADJiDhuZjYcjQVOpwTG0BzUOKB7wbqai_NNLSzz=1oX_fobwyQ@mail.gmail.com> |
The simple solution is to send a document that is an array. This way you can send the `-` that starts the next element before you actually have it, this will indicate the previous element is done. You can also send `--` to complete the `---` to mark a new document. Alas, you'd have to send an empty _something_ at the very end... On Mon, Nov 18, 2013 at 2:49 PM, Alexey Zakhlestin <[email protected]>wrote: > 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 > > ------------------------------------------------------------------------------ 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