Repository navigation
v0.6.0
Added
-
status::foreignandSBX_E_FOREIGN(-12): the segment's magic is not
one this version knows. Python raisesSchemaMismatchError. (#47) -
sharedbox::to_expectedandsharedbox::from_expected: convert a
sharedbox::resultto astd::expectedand back on C++23. (#47) -
KindMismatchError, aSchemaMismatchErrorraised when a name holds a
segment of another kind;status::kind_mismatchandSBX_E_KIND(-11)
insharedbox.hppandsharedbox_c.h. (#47) -
sharedbox::stream,sharedbox::stream_senderandsharedbox::stream_reader
instream.hpp, included bysharedbox.hpp: a ring in shared memory with
one sender and up tomax_readersreaders, each reading
read_mode::lossless,read_mode::lossyorread_mode::latest, laid out
as stream layout 1.0. C++ only.stream_sender::begin,publishand
abandonreserve a slot, fill it in place and publish it or give it up. (#48) -
status::busy(-13),status::ended(-14) andstatus::interrupted
(-15), withSBX_E_BUSY,SBX_E_ENDEDandSBX_E_INTERRUPTEDin
sharedbox_c.h. (#48) -
SharedStream,SharedSendStreamandSharedReceiveStream: send items of
any type aSharedBoxfield takes from one process to up tomax_readers
readers, each readinglossless,lossyorlatest, with blocking,
non-blocking and asyncio calls,receive_intointo the caller's arrays and
receive_future, aconcurrent.futures.Future. A stream passed to another
process arrives attached, or raisesSchemaMismatchErrorif its name now
holds a stream created since, andSharedStream.createwithout a name gives
the stream a new one. The ends cannot be pickled;SharedSendStream.stream
andSharedReceiveStream.streamreturn their stream. (#49) -
SharedReceiveStream.events, aReceiveEventspsygnal group whose
receivedandendedsignals deliver a reader's items to callbacks. (#49) -
WouldBlock,EndOfStream,StreamBusyErrorandStreamClosedError. (#49) -
SharedStreamStatisticsandReceiveStreamStatistics, returned by
SharedStream.statistics(). (#49) -
WaiterSlotsFullErroris exported fromsharedbox; opening a reader
raises it whenmax_readersreaders are open. (#49) -
benchbox ops: the rowwatched write int, a write while another process
has a watcher open. (#50) -
sharedbox::handle::sleepers(): the number of threads inside a wait on
the box, in any process. (#51) -
benchbox stream: items per second ofSharedStreamreaders in each mode
againstmp.Queueand aSharedMemoryring with a lock, and a table of
sendandasendwithreceive,async forandevents.received,
with the 50th, 90th and 99th percentile latency.--short,--table,
--jsonand--markdownare its options;benchbox allruns it and
writesstream.json. (#53) -
Streamsworkflow:benchbox streamon the base branch against the pull
request, withscripts/stream_compare.pywriting the table. (#53) -
benchbox roundtrip: the rowSharedStream. (#53) -
benchmarks/test_bench_stream.py: a CodSpeed benchmark ofsendplus
receive_into. (#53) -
FieldWatch.future(), returning aFieldFuture, a
concurrent.futures.Futureof the next write to the field;FieldFuture
is exported fromsharedbox. (#55) -
field(shape=...): the sizes of an array field of a box.class Grid(SharedBox): cells: npt.NDArray[np.uint8] = np.zeros((4, 6), np.uint8) weights: npt.NDArray[np.float32] = field(shape=(3,))
A box array field also takes its sizes from a plain default array, so it
needs noShapeand, with a dtype in its annotation, noDType. (#56) -
SharedSendStream.writing()andSharedSendStream.awriting(), which yield a
SendSlot:blank = Frame(0, np.empty((0, 0), np.uint16)) with sender.writing(blank) as slot: slot.item.image.fill(0) slot.send(replace(slot.item, index=1))
slot.itemis an item built from a template, with arrays over the next slot
to fill in place, andslot.send(item)publishes an item without copying the
arrays already in the slot. (#58)
Changed
sharedbox.hpp: split intocore.hppandbox.hpp, which it includes.
sharedbox::resultis the library's own type on C++20 and C++23 alike,
and itserror()is asharedbox::errorholding the status, the OS error
and what was found. The C++ names moved fromsharedbox::v2to
sharedbox::v3. (#47)sharedbox::header: the magic, versions, schema hash, creator, waiter
slot count and size moved into its first member,common, a
sharedbox::common_header;layout_majorandlayout_minorbecame
common.kind_majorandcommon.kind_minor. (#47)sharedbox::error: astatus::osfailure carries the OS error in
error().os;errnoandGetLastError()no longer hold it reliably
when the call returns. (#47)- Segment layout: every segment starts with a common first line (magic,
core version, layout version of its kind, schema hash, creator), and
boxes use layout 3.0. A box made by 0.5 cannot be opened by 0.6, nor the
other way round. (#47) sharedbox::inspect: returnsresult<common_header>. (#47)sharedbox::magic: renamedsharedbox::box_magic. (#47)box_ref: a reference field stores the name of its target in 240 bytes,
so the field takes 256 bytes. (#47)SharedBoxnames: one or more segments of[A-Za-z0-9_-]joined by
:, up to 240 characters, such asbl01:camera:det1:frames..is no
longer allowed. The shared memory is/dev/shm/SBX:<name>on Linux and
Local\SBX:<name>on Windows, and Windows waiter events end in#w<i>. (#47)SharedBox.attach: a segment whose magic this version does not know,
such as a box made by 0.5, raisesSchemaMismatchErrorat once, instead
ofSegmentNotFoundErrorafter the timeout. (#47)SharedBoxwrite: makes a wake call only when a thread is waiting on the
box.sleepers, at offset 84 of box layout 3.0, counts the threads inside
a wait. It adds 1 towake_wordonly whensleepersis not 0. (#51)sharedbox::waiter_slot: 32 bytes, withasleep_on, at offset 24, the
offset of the count the slot's current wait added 1 to, and a reserved
word. Freeing the slot of a process killed inside a wait takes that
thread out ofsleepersfor a box, and out ofdata_waitingor
space_waitingfor a stream. (#51)benchbox plot: writes plotly figure JSON (charts/ops.json,
roundtrip.json,stream-throughput.json,stream-matrix.json) instead
of SVG files. (#53)benchmarksextra and group: depend onplotlyinstead ofmatplotlib. (#53)- Array fields: an annotation that names its number of dimensions, as in
numpy.ndarray[tuple[int, int], numpy.dtype[numpy.uint8]], raises
TypeErrorwhen itsShapehas another number, in a box, a record and a
stream item. (#56) - Array fields: a default array whose shape differs from the field's
Shape
raisesTypeErrorinstead ofValueErrorwhen the class is defined. (#56)