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.cppto separate the classes in that file into separate.cppfiles:LabelSessionReadSessionHeaderCheckerReadFileWriteSessionWriteFile
-
Add helper methods to ReadSessionandReadFileclasses 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 ReadSessionandReadFileinto pure virtual functions. Create subclasses (example names:CtaReadSessionandCtaReadFile) 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 aReadFileobject, it can returnCtaReadFileinstead). Same forReadSessionandopenReadSession.
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 OsmReadSessionandOsmReadFile -
Modify openReadFileandopenReadSessionto 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.