Glossary¶
Each word on this page has its meaning written down once, here, and every other page links to it the first time it uses the word. If a page uses a word you don't know, its link brings you to this page.
Acronyms are explained in tooltips across the site: hover over a word with a dotted underline to read what it stands for.
Attribute¶
An attribute is a field declared with Attr
or Setting. It holds a value its owner publishes,
with the time of each publish, and, when it takes requests, a request part
through which other processes ask the owner to act. A Setting also holds
a setpoint.
Box¶
A box is a record that several processes share. You describe it with a
subclass of SharedBox, and its fields
live in one segment of shared memory, so every
process that opens the segment reads and writes the same values. In Python,
"box" also means the object you use to reach that record; several such
objects, in one process or in many, can be handles on the same
segment.
Capacity¶
A capacity is how much room a field of varying size gets, since every field
has a fixed size. For str, bytes, bytearray and Decimal it is the
most bytes the value can take, and for a list, set or dict the most
elements. You set it with Capacity inside
Annotated. For text it counts bytes, not characters, and the field takes
up all that room whatever it holds.
Channel¶
A channel is the set of streams and the box that
sharedbox.bluebox uses to carry the documents of bluesky
runs from one process to others: a control stream for every document other
than events, one stream per descriptor for its events, and a box holding
the run under way. It has one sender and as many receivers as its max_readers allows. See How bluebox carries documents.
Create id¶
A create id is a random number a box gets when it is created, never 0, kept with the box. It tells two boxes apart that had the same name at different times: a reference field and a pickled box store it, so they can notice that the box they knew was removed and a new one created under its name. See Reference fields.
Description¶
A description is the extra information a segment keeps for a type whose name alone doesn't say how its values are laid out: an enum's members, a record's members and their names, a list's capacity, or an array's shape and element type.
Document¶
A document is one of the dicts a bluesky RunEngine emits to describe a
run, each with a name such as start, descriptor, event or stop. A
start opens a run, a descriptor says what the events of one stream
hold, each event or event_page carries readings, and a stop closes the
run.
Field¶
A field is one value of a box, declared as a public annotation of a
SharedBox subclass with a type a box can store. Each field has a fixed
place and a fixed size in the segment. See
How a box is stored.
Handle¶
A handle is one way in to a segment, held by one user: a box
object in Python, or the handle in the capsule that
__sharedbox_box__ gives a C or
C++ library. Each handle has the segment mapped into its process on its
own, so closing one handle leaves the others working. See
Closing and lifetime.
Identity¶
The identity of a SharedBox class is the string that names the class the
same way in every process. It is the class's module.qualname, unless the
class sets the identity keyword. The box's default name and its
schema hash are both worked out from it.
Latest¶
Latest is a reader mode in which the reader always receives the
newest item of the stream and skips the rest. See
reader.
Lossless¶
Lossless is a reader mode in which the reader receives every item
of the stream. A sender that is capacity items ahead of
a lossless reader waits for it. See reader.
Lossy¶
Lossy is a reader mode in which the reader skips the items the
sender overwrote while it was busy, and counts them in
missed. Once it is a whole ring
behind it goes on from the middle of the ring. See
reader.
Metadata¶
Metadata is a value a box or stream keeps in its
segment to say what its fields or items mean, such as their
units or the calibration they were taken with. Every process reads it from
the segment, and adding a new value adds a
metadata version. The metadata of
field is a different thing, kept in each process's
class. See
How to attach metadata to a box or stream.
Metadata version¶
A metadata version is one value of a box's or stream's
metadata, numbered from 1. Adding metadata adds a version and
leaves the earlier ones as they were, until the box or stream lets the
oldest go to make room for new ones. A stream item belongs to the newest
version its sender added with that item or before it. See
update and
send.
Reader¶
A reader is an object that receives the items of a stream in one
process. Each reader has its own position in the stream and a mode:
lossless, lossy or latest. See
SharedReceiveStream.
Released reader¶
A released reader is a lossless reader that the
sender stopped waiting for: the sender was opened with
on_full="release", and a send waited its whole timeout. Its next receive raises
ReaderReleased with the number of items it
lost, and it goes on at the newest item. See
sender.
Reference field¶
A reference field is a field annotated with another SharedBox
subclass, or with that class | None, so one box can point at another. It
stores which box it points at, not that box's values: the box's name,
schema hash and create id. The other box keeps
its own segment, lock and lifetime. See Reference fields.
Schema hash¶
A schema hash is a short fingerprint of a box's layout: a number worked out from the class's identity and each field's name, type and capacity (the first 8 bytes of a SHA-256 hash of them). The segment keeps it, and a process that attaches works it out again from its own class. If the two differ, the classes don't describe the same layout, and the attach is refused instead of reading the wrong bytes. See How a box is stored.
Segment¶
A segment is the block of shared memory that holds one
box. Besides the values, it holds a header, a table of the fields
and the waiter slots. It has a name, SBX:<name>, by
which any process can open it. See
How a box is stored.
Sender¶
A sender is the object that sends the items of a stream. A stream
has one at a time, and closing it ends the stream. See
SharedSendStream.
Sequence lock¶
The sequence lock is how a box keeps readers from seeing half a write. It is a counter in the segment that is even when no write is running and odd while one is. A writer makes the counter odd, copies its values, and makes it even again. A reader doesn't lock anything: it copies, and if the counter moved in the meantime, it copies again. See Reading and writing.
Shared memory¶
Shared memory is memory the operating system lets several processes use at the same time, so a value one process writes there is immediately there for the others to read, without being sent. Each box is kept in a block of it, its segment.
Stream¶
A stream is a series of items that one process sends and up to
max_readers readers receive. A segment of
shared memory holds the last capacity items. See
SharedStream.
Waiter slot¶
A waiter slot is an entry in a segment that a waiting thread
holds, so that a write knows whom to wake up. The thread is a box's
watcher, or a C++ program that called register_waiter. The
slot records which process holds it, so a slot left behind by a process
that crashed can be freed again. A box has a fixed number of slots, shared
by every process. See Waiting for changes.
Watcher¶
A watcher is a background thread of a box handle that waits for
writes from any process. It runs the callbacks you connect to
events and delivers the values that
watch gives you, and it holds one
waiter slot while it waits. See
Waiting for changes.