Skip to content

Add support to CTA for multiple tape label formats

Problem to solve

CTA needs to add support for reading OSM/dCache and Enstore tape formats, as agreed at the EOS Workshop 2022 BoF.

The dCache devs have a working proof-of-concept implementation, see details in !187 (closed)

To properly integrate this feature into CTA, we should refactor the code in CTA/tapeserver/castor/tape/tapeserver/file/File.cpp.

Stakeholders

  • dCache developers
  • Fermilab/Enstore replacement developers

Proposal

First, some refactoring:

  • Refactor CTA/tapeserver/castor/tape/tapeserver/file/File.cpp to separate the classes in that file into separate .cpp files:
    • LabelSession
    • ReadSession
    • HeaderChecker
    • ReadFile
    • WriteSession
    • WriteFile
  • Add helper methods to ReadSession and ReadFile classes to abstract out the specific details of how to read the tape file. See !187 (closed) and in particular !187 (comment 5597846) for an overview of which helper functions are needed.
  • Change the helper methods in ReadSession and ReadFile into pure virtual functions. Create subclasses (example names: CtaReadSession and CtaReadFile) and move the CTA helper method implementations into those classes.
  • Instantiate on the appropriate subclass of ReadFile when we call openReadFile (currently returns a smart pointer to a ReadFile object, it can return CtaReadFile instead). Same for ReadSession and openReadSession.

After this refactoring is done, we should add this to a release and deploy, to ensure there are no regressions.

Then we can add in the dCache OSM label format implementation:

  • Add empty subclasses OsmReadSession and OsmReadFile
  • Modify openReadFile and openReadSession to check the label format. If it is OSM format, return the OSM classes. Otherwise, by default return CTA label format classes.
  • dCache developers can add their implementation.

The last 3 points above can be repeated for the Enstore format.

Edited by Jorge Camarero Vera