Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it pluggable #16

Open
ewildgoose opened this issue Apr 18, 2018 · 1 comment
Open

Make it pluggable #16

ewildgoose opened this issue Apr 18, 2018 · 1 comment
Labels

Comments

@ewildgoose
Copy link

I like the idea of this module as a kind of generic "plug" but for network services. So after parsing you want to consult other code about whether to advance with parsing or not (possibly further parsing is dependent on state). Of course it's sensible to look at moving this completely externally, but equally it seems useful to sometimes want your parser to consume subsequent input based on some external state?

Might be a new PR, but I also see a potential for needing timeouts on parsing?

@njonsson
Copy link
Owner

Thanks for chiming in, @ewildgoose!

Your characterization of this as a network-service plug resonates. The existing API for conditional parsing is StructuredIO.read_complex/3, which takes a function; returning {:ok, term} from the function consumes data from the stream. Tell me your thoughts on this.

As to timeouts, each of the StructuredIO.read* functions has an optional timeout parameter. Did you have something else in mind?

@njonsson njonsson added the maybe label Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants