
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
home : https://hg.sr.ht/~ged/CZTop-Reactor
code : https://hg.sr.ht/~ged/CZTop-Reactor/browse
github : https://github.com/ged/cztop-reactor
docs : http://deveiate.org/code/cztop-reactor
This is an implementation of the Reactor pattern described in Pattern-Oriented Software Architecture (Volume 2). It allows an asynchronous application to be described as one or more "reactions" to events, in this case either I/O conditions on a ZMQ socket or a timer expiring.
A simple example:
# Start a SERVER socket, and print out any messages sent to it
reactor = CZTop::Reactor.new
socket = CZTop::Socket::SERVER.new
socket.bind( 'tcp://0.0.0.0:8' )
reactor.register( socket, :read ) do |event|
if event.readable?
message = event.socket.receive
puts "Read: %p" % [ message.to_a ]
end
end
reactor.start_polling
It should run under any Ruby interpreter that CZTop will, which at the time of this writing includes:
I am also using it (and CZTop) under MRI 2.6.
$ gem install cztop-reactor
I considered submitting this as a patch to cztop
, but in the end elected to
distribute it as a gem for two reasons:
timers
gem, and I didn't want to add this dependency to
cztop
. If the ztimerset
spec ever comes out of draft status
and cztop
adds an implementation of it, this wouldn't be necessary.You can check out the current development source with Mercurial via its {project page}[https://hg.sr.ht/~ged/CZTop-Reactor]. Or if you prefer Git, via {its Github mirror}[https://github.com/ged/cztop-reactor].
After checking out the source, run:
$ gem install rake-deveiate
$ rake setup
This task will install any missing dependencies, run the tests/specs, and generate the API documentation.
This library includes source from the CZTop gem by Patrik Wenger, which is distributed under the terms of the ISC License:
Copyright (c) 2016, Patrik Wenger
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Everything else is distributed under the same license but is:
Copyright (c) 2017-2023, Michael Granger
FAQs
Unknown package
We found that cztop-reactor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.