RingSourceMgr

Name

RingSourceMgr -- A callout bundle that spawns ringFragmentSource processes.

DESCRIPTION

The RingSourceMgr is an improved means for launching the ringFragmentSource processes that feed data to the event builder. In the past, users had to explicitly call EVBC::startRingSource, which merely launched an instance whose information was transient. The RingSourceMgr changes this by storing all of the information about the various ringFragmentSources that will feed the event builder. In doing so, the program has better knowledge about the processes that are running in the data stream. In the future there is also the possibility of adding graphical control over the information stored in the RingSourceMgr.

The RingSourceMgr is also a callout bundle for the ReadoutGUI state machine. Unless you need some special implementation of the RingSourceMgr's utlities, the most you will need to do with the API of the RingSourceMgr is to call the RingSourceMgr::register and RingSourceMgr::addSource procs. Doing so will cause the ReadoutGUI's state machine to invoke the desired functionality during state transitions of importance. The state transitions of interest and the logic executed is described here.

Entering NotReady state from any other state: All knowledge of ringFragmentSource processes discarded.

Leaving Halted state for Active state: There is a waiting period during which the RingSourceMgr checks for the presence of the event builder to start. Once an event builder has been established, ringFragmentSource processes are launched for all sources that are currently registered.

NAMESPACE PROCS

RingSourceMgr::register bundleName

Adds the RingSourceMgr callout bundle to the ReadoutGUI's state machine before the bundle bundleName. The bundleName must have already been added to the state machine.

RingSourceMgr::addSource sourceUrl tstampLibPath ids info expectBodyHeaders oneshot timeout offset

sourceUrl

The sourceUrl is the URL of the data source. This should the url of a ring buffer (e.g. tcp://someHost/ringName).

tstampLibPath

The tstampLibPath is the path to the user's timestamp extractor library. This is allowed to be left as an empty string if the expectBodyHeaders argument is passed a true value.

ids

The ids argument is a list of acceptable source ids. If the ringFragmentSource sees a ring item with a source id different than what is provided here, then the process with exit. If there was no body header on the ring item, the ringFragmentSource will add a body header with a source id that is the same as the first element of the list passed to this argument.

info

The info is a generic string that is used to label the data source in the event builder GUI.

expectBodyHeaders

The optional expectBodyHeaders argument is defaulted to false and specifies whether all data passing into the ringFragmentSource can be expected to have body headers, in other words, a source id and timestamp. If the ringFragmentSource is told to expect body headers, it allows the caller to omit a valid timestamp extractor library path. This however causes the ringFragmentSource to exit in failure if data arrives wihout a body header. When the expectBodyHeaders argument is set to false, then the user must provide a valid timestamp extractor library to assign a timestamp to the ring item. Be aware that if the data arrives with body headers already, the user's timestamp extractor will be ignored while the timestamp in the body header will be used.

oneshot

The optional oneshot argument specifies whether the ringFragmentSource should exit after a symmetric number of begin and end runs have been observed. By default it is set to false.

timeout

The optional timeout argument specifies the number of seconds that the ringFragmentSource will wait since the first end run arrives before shutting down. By default this is set to 20 seconds.

offset

The optional offset argument is used to define a integer value to add to the timestamp. One can use this to compensate for a known, stable synchronization offset between data streams passing through the event builder.

RingSourceMgr::getOrdererPort

Retrieves the port that the event builder is listening for connections on. This works with the DAQPortManager to obtain the port so it is necessary that the the port manager is running. If the port cannot be found, an exceptional return occurs with an error code.

RingSourceMgr::clearSources

Deletes all knowledge of the sources that had been registered previously.

RingSourceMgr::resetSources

Deletes all knowledge of running ringFragmentSource processes.

RingSourceMgr::startSource sourceUrl tstampLibPath ids info expectHeaders oneshot timeout offset

Launches a ringFragmentSource process directly. The parameters have the same semantics and default values as the RingSourceMgr::addSource proc.

RingSourceMgr::onBegin

This essentially just calls RingSourceMgr::startSource for each of the registered ring sources.

RingSourceMgr::attach state

This is a no-op.

RingSourceMgr::enter from to

When to is "NotReady" it calls ::RingSourceMgr::resetSources.

RingSourceMgr::leave from to

When from is "Halted" and to is "Active", the event builder is waited on to become available and then ::RingSourceMgr::onBegin is called.