Class ConvertPVNameToKey
java.lang.Object
org.epics.archiverappliance.config.ConvertPVNameToKey
- All Implemented Interfaces:
PVNameToKeyMapping
Most labs use a standard character (typically the ":" or the "-" character) in their naming conventions to separate out the components of a name.
We want to replace these characters with the File.separator so that the key/file structure reflects the naming convention reasonably closely
This give us 2 things
- All the files/keys for the entire archiver system do not land in the same folder. This improves performance significantly on ext2/3/4 like filesystems which can handle upto around 10000 files in a folder reasonably well but are very inefficient if this limit is crossed. Note, systems like ZFS/BTRFS do not have this limitation.
- We have a deterministic way to go from PV name to key/file name
One other issue we need to solve is that some PV's (X:CTRD_V) are substrings of other PV's (X:CTRD_V_BOOK).
So, files for X:CTRD_V are matches for X:CTRD_V_BOOK as well.
We can either replace the underscores with /'s as well.
Or the character that separates the final name component of the PV name from the rest of the file name (time partition info, extension etc) should also be something that would not show up in a PV name at the end.
For now, we choose the latter and use another property to identify the separator string (for example ":") as the terminator.
For example, X:CTRD_V_BOOK is mapped to X/CTRD_V_BOOK:.
This class uses two properties obtained from the archappl.properties file to map PV names to keys.
- org.epics.archiverappliance.config.ConvertPVNameToKey.siteNameSpaceSeparators - This is a list of characters that separate the components of the PV name. The syntax for this must satisfy Java's
replaceAllregex requirements. So to specify a list containing the ":" and the "-" characters, we have to use[\\:\\-] - org.epics.archiverappliance.config.ConvertPVNameToKey.siteNameSpaceTerminator - This is the character used as the terminator of the PV name portion of the key.
- Author:
- mshankar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]breakIntoParts(String pvName) Break a PV name into parts separated by the site specific separators For examples, ABC:123:DEF gets broken into [ABC, 123, DEF]convertPVNameToKey(String pvName) protected StringgenerateChunkKey(String pvName) One option is to simply override the final element of chunk key generation.voidinitialize(ConfigService configService) overrideTerminator(char terminator)
-
Constructor Details
-
ConvertPVNameToKey
public ConvertPVNameToKey()
-
-
Method Details
-
convertPVNameToKey
- Specified by:
convertPVNameToKeyin interfacePVNameToKeyMapping
-
initialize
- Specified by:
initializein interfacePVNameToKeyMapping- Throws:
ConfigException
-
generateChunkKey
One option is to simply override the final element of chunk key generation. To do that, subclass and override this method. (Of course, you still have to register the subclass in archappl.properties).- Parameters:
pvName- The name of PV.- Returns:
- pvName
-
breakIntoParts
Description copied from interface:PVNameToKeyMappingBreak a PV name into parts separated by the site specific separators For examples, ABC:123:DEF gets broken into [ABC, 123, DEF]- Specified by:
breakIntoPartsin interfacePVNameToKeyMapping- Parameters:
pvName- The name of PV.- Returns:
- String Parts separated by separators
-
overrideTerminator
- Specified by:
overrideTerminatorin interfacePVNameToKeyMapping
-