Class ConvertPVNameToKey

  • All Implemented Interfaces:

    public class ConvertPVNameToKey
    extends Object
    implements 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
    1. 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.
    2. 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 file to map PV names to keys.

    1. 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 replaceAll regex requirements. So to specify a list containing the ":" and the "-" characters, we have to use [\\:\\-]
    2. org.epics.archiverappliance.config.ConvertPVNameToKey.siteNameSpaceTerminator - This is the character used as the terminator of the PV name portion of the key.

    • Constructor Detail

      • ConvertPVNameToKey

        public ConvertPVNameToKey()
    • Method Detail

      • generateChunkKey

        protected String generateChunkKey​(String pvName)
        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
        pvName - The name of PV.
      • containsSiteSeparators

        public boolean containsSiteSeparators​(String pvName)
        Description copied from interface: PVNameToKeyMapping
        Return true if the given pvName contains any site specific separators.
        Specified by:
        containsSiteSeparators in interface PVNameToKeyMapping
        pvName - The name of PV.
        boolean True or False
      • breakIntoParts

        public String[] breakIntoParts​(String pvName)
        Description copied from interface: PVNameToKeyMapping
        Break a PV name into parts separated by the site specific separators For examples, ABC:123:DEF gets broken into [ABC, 123, DEF]
        Specified by:
        breakIntoParts in interface PVNameToKeyMapping
        pvName - The name of PV.
        String Parts separated by separators