Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
Pushes
fibers.optowards a first-class CML event API and rewires the library, examples, and tests around an explicitperformentry point.Main changes:
Core op API
op.perform(ev)as the single synchronization primitive, instead of calling:perform()on events.Event:or_else(fallback_thunk)as a biased choice combinator using a “next turn” primitive rather than the oldperform_alt.Event:on_abort(f)and wires it into the same nack machinery aswith_nack, so abort handlers fire when an arm loses in a choice.op.bracket(acquire, release, use)for RAII-style resource protocols over events (release called on both success and abort).op.always(value)andop.never()helpers for simple always-ready / never-ready primitives.op.new_condto support abort-only conds (optionalabort_fn, nowait_op), and updates nack signalling logic to drive bothwith_nackandon_abort.Library & examples
ev:perform()/ev:perform_alt()toop.perform(ev)andev:or_else(...).fibers.channel,fibers.cond,fibers.waitgroup,fibers.sleep,fibers.stream,fibers.stream.file,fibers.pollio,fibers.exec,fibers.alarm, and the cqueues integration example to importperform/choicelocally and use the new API.choices,choices-alt,choices-adv, context examples, lua-http integration) to show thechoice(...)+perform(...)style instead of method-chaining on ops.Tests
Reworks
tests/test_op.luainto a compact suite aligned with the new API:perform,choice,always,never,or_else,with_nack, andbracket.with_nack, and bracket abort vs success semantics.Updates
tests/test_stream-file.lua,tests/test_waitgroup.lua, andtests/test_context.luato:perform/choiceinstead of:perform()/perform_alt().:or_else(...)instead ofperform_alt.Docs / formatting
Behavioural note: this is a public API nudge — consumers should migrate from
op.choice(...):perform[_alt]()toperform(choice(...))/ev:or_else(...)over time.This passes the full test suite.
Related Issues, Tickets & Documents
None.
Screenshots/Recordings
Not applicable.
Manual test
Manual test description
Ran the full test suite locally (including updated op / stream / waitgroup / context tests) and exercised the examples using the new
perform/choiceAPI.Added tests?
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?
:perform()/:perform_alt()on ops should be guided towardsop.perform(ev)andev:or_else(...).