-
Notifications
You must be signed in to change notification settings - Fork 3
Current API flaws
- Passive filters need to know which side (source or sink) is called by primary driver (the opposite is called by the secodary one, spawned by spawn and joined by stop).
Current API needs workarounds for that: e.g. parallel uses DriveMode hack to check whether driver calling stop is on source or sink side.
-
Buffer is extremely unsafe requiring the user to specify element types on each method call, instead of just once upon buffer instantiation.
-
All buffer methods should be nothrow.
Buffer.allocshould returnnullif it can't fulfill the request.FallbackBuffershould check for that and use the fallback implementation. Something likeThrowingBuffershould be implemented as buffer wrapper for use in stages. This one will throw when the underlying buffer implementation is unable to fulfillallocrequest. -
Current signature of
Stage.allocis ridiculous. It should just accept size and return a writable slice:
E[] alloc(size_t n);It should block until slice of that size is available or throw if it will never be. To make the latter easier to implement in stages, Buffer should also implement @property capacity.
- Peek-alloc filter style naturally fits most buffer-to-buffer transforms (zlib, SRC, openssl), yet it requires that the stage is a driver that does everything inside
runand adapters between such stages need fibers to switch between drivers instead of just callingstepand see if there's enough data for sink'speekrequest.
Solution: in flod.traits, implement a template to test for optional stage members. Adapters can test for step, and use a fiberless implementation.
- Current metadata API is next to useless. Tags need to be set before any data are sent, but shouldn't be set in constructors because some getters might not be constructed yet. Stages that want to set tags just once at the beginning need to have a flag for first call. Stages that want to set tags only but won't change data need to implement all methods to avoid inserting adapters. Setting metadata in the middle of a stream is currently allowed but frequently some data will be buffered in next stages, and the update will come too early to the getter. Some ideas:
- Flush the stream before setting metadata?
- Maintain offsets in all stages and attach offset to each tag change?
- ???