nDiskFileRead

class nDiskFileRead : public kotekan::Stage

Producer kotekan::Stage which reads VDIF data from multiple drives into a Buffer

This is a producer which initiates n threads to read from n disks. Each disk must contain data in the same folders as specified in the kotekan config file. Within each folder the data files must be numbered incrementally across the disks. Since the file format is the most important aspect of this stage, a worked example for a set of 3 disks is shown below.

Todo:

Add rest server commands.

Buffers

  • out_buf The kotkean buffer to hold the data read from the drives

    • Format: Array of unsigned char, just copies the file.

    • Metadata: none

Worked Example with n = 3:

kotekan::Config Parameters:

  • num_disk: 3

  • disk_base: /drives/

  • disk_set: /D/

  • capture: 20170805T155218Z_aro_vdif

  • starting_index: 0

What the file paths should look like:

Drive 0:

  • /drives/D/0/20170805T155218Z_aro_vdif/0000000.vdif

  • /drives/D/0/20170805T155218Z_aro_vdif/0000003.vdif

  • /drives/D/0/20170805T155218Z_aro_vdif/0000006.vdif

Drive 1:

  • /drives/D/1/20170805T155218Z_aro_vdif/0000001.vdif

  • /drives/D/1/20170805T155218Z_aro_vdif/0000004.vdif

  • /drives/D/1/20170805T155218Z_aro_vdif/0000007.vdif

Drive 2:

  • /drives/D/2/20170805T155218Z_aro_vdif/0000002.vdif

  • /drives/D/2/20170805T155218Z_aro_vdif/0000005.vdif

  • /drives/D/2/20170805T155218Z_aro_vdif/0000008.vdif

Author

Jacob Taylor

Warning

Not getting the file format correct will usually result in a segmentation fault. It can be hard to figure out what is happening, so be extra cautious.

Param num_disks:

Int , the number of drives to read from (Example: 10)

Param disk_base:

String, the path to the mounted drives (Example: ‘/drives/’)

Param disk_set:

String, the disk name (Example: ‘D’)

Param capture:

String, the subfolder of the current data set (Example: 20170805T155218Z_aro_vdif)

Param starting_file_index:

Int, an offset for where to start in the data set (Example: 10232)

Public Functions

nDiskFileRead(kotekan::Config &config, const std::string &unique_name, kotekan::bufferContainer &buffer_containter)

Constructor.

inline ~nDiskFileRead() override

Destructor, currently does nothing.

void file_read_thread(int disk_id)

Entrance point for n threads. Reads files from a given drive in order and places the file contents into a kotekan buffer.

Parameters:

disk_id – Tells the function which disk to read off of. The function will read off of the disk indicated by disk_id.

virtual void main_thread() override

Creates n safe instances of the file_read_thread thread.