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
andReadFile
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
andReadFile
into pure virtual functions. Create subclasses (example names:CtaReadSession
andCtaReadFile
) 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 aReadFile
object, it can returnCtaReadFile
instead). Same forReadSession
andopenReadSession
.
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
andOsmReadFile
-
Modify openReadFile
andopenReadSession
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