Class ChannelArchiverReadOnlyPlugin

  • All Implemented Interfaces:
    Reader, StoragePlugin, Writer

    public class ChannelArchiverReadOnlyPlugin
    extends Object
    implements StoragePlugin
    A storage plugin that can front a Channel Archiver Data Server. Only reads are supported. This has the ability to support reduced data sets like LCLS_SPARSE but this is optional. If a sparse key is not specified, we default to using the un-reduced archive key. Integration test plan for this. Try to include
    1. A PV that is archived in both the appliance and ChannelArchiver. Date ranges should be appliance only, overlap and ChannelArchiver only.
    2. A PV that is archived in only the ChannelArchiver.
    Author:
    mshankar
    • Constructor Detail

      • ChannelArchiverReadOnlyPlugin

        public ChannelArchiverReadOnlyPlugin()
      • ChannelArchiverReadOnlyPlugin

        public ChannelArchiverReadOnlyPlugin​(String serverURL,
                                             String index)
      • ChannelArchiverReadOnlyPlugin

        public ChannelArchiverReadOnlyPlugin​(String serverURL,
                                             String index,
                                             int valuesRequested,
                                             String howStr)
    • Method Detail

      • getDescription

        public String getDescription()
        Description copied from interface: StoragePlugin
        Get a string description of this plugin; one that can potentially be used in log messages and provide context.
        Specified by:
        getDescription in interface StoragePlugin
        Returns:
        description
      • initialize

        public void initialize​(String configURL,
                               ConfigService configService)
                        throws IOException
        Description copied from interface: StoragePlugin
        Each storage plugin is registered to a URI scheme; for example, the PlainStoragePBPlugin uses pb:// as the scheme. Configuration for a storage plugin typically comes in as a URL like URI.
        1. The config service identifies the storage plugin using the scheme ("pb" maps to PlainStoragePBPlugin)
        2. Creates an instance using the default constructor.
        3. Calls initialize with the complete URL.
        The storage plugin is expected to use the parameters in the URL to initialize itself.
        Specified by:
        initialize in interface StoragePlugin
        Parameters:
        configURL - The complete URL
        configService -  
        Throws:
        IOException -  
        See Also:
        StoragePluginURLParser
      • getServerURL

        public String getServerURL()
      • setServerURL

        public void setServerURL​(String serverURL)
      • getArchiveKey

        public int getArchiveKey()
      • setArchiveKey

        public void setArchiveKey​(int archiveKey)
      • setDescription

        public void setDescription​(String description)
      • getReducedArchiveKey

        public int getReducedArchiveKey()
      • setReducedArchiveKey

        public void setReducedArchiveKey​(int reducedArchiveKey)
      • getLastKnownEvent

        public Event getLastKnownEvent​(BasicContext context,
                                       String pvName)
                                throws IOException
        Description copied from interface: Writer
        Gets the last known event in this destination. Future events will be appended to this destination only if their timestamp is more recent than the timestamp of this event. If there is no last known event, then a null is returned.
        Specified by:
        getLastKnownEvent in interface Writer
        Parameters:
        context -  
        pvName - The PV name
        Returns:
        Event The last known event of pvName
        Throws:
        IOException -  
      • getFirstKnownEvent

        public Event getFirstKnownEvent​(BasicContext context,
                                        String pvName)
                                 throws IOException
        Description copied from interface: Reader
        Get the first event for this PV. This call is used to optimize away calls to other readers that have older data.
        Specified by:
        getFirstKnownEvent in interface Reader
        Parameters:
        context -  
        pvName - The PV name
        Returns:
        Event The first event of pvName
        Throws:
        IOException -  
      • getName

        public String getName()
        Description copied from interface: StoragePlugin
        Multiple PVs will probably use the same storage area and we identify the area using the name. This is principally used in capacity planning/load balancing to identify the storage area for the PV. We should make sure that storage's with similar lifetimes have the same name in all the appliances. The name is also used to identify the storage in the storage report. For example, the PlainPBStoragePlugin takes a name parameter and we should use something like STS as the identity for the short term store in all the appliances.
        Specified by:
        getName in interface StoragePlugin
        Returns:
        name
      • renamePV

        public void renamePV​(BasicContext context,
                             String oldName,
                             String newName)
                      throws IOException
        Description copied from interface: StoragePlugin
        Change the name of a PV. This happens occasionally in the EPICS world when people change the names of PVs but want to retain the data. This method is used to change the name of the PV in any of the datasets for PV oldName. For example, in PB files, the name of the PV is encoded in the file names and is also stored in the header. In this case, we expect the plugin to move the data to new files names and change the PV name in the file header. To avoid getting into issues about data changing when renaming files, the PV can be assumed to be in a paused state.
        Specified by:
        renamePV in interface StoragePlugin
        Parameters:
        context -  
        oldName - The old PV name
        newName - The new PV name
        Throws:
        IOException -  
      • convert

        public void convert​(BasicContext context,
                            String pvName,
                            ConversionFunction conversionFuntion)
                     throws IOException
        Description copied from interface: StoragePlugin
        Sometimes, PVs change types, EGUs etc. In these cases, we are left with the problem of what to do with the already archived data. We can rename the PV to a new but related name - this keeps the existing data as is. Or, we can attempt to convert to the new type, EGU etc. This method can be used to convert the existing data using the supplied conversion function. Conversions should be all or nothing; that is, first convert all the streams into temporary chunks and then do a bulk rename once all the conversions have succeeded. Note that we'll also be using the same conversion mechanism for imports and other functions that change data. So, when/if implementing the conversion function, make sure we respect the typical expectations within the archiver - monotonically increasing timestamps and so on. To avoid getting into issues about data changing when converting, the PV can be assumed to be in a paused state.
        Specified by:
        convert in interface StoragePlugin
        Parameters:
        context -  
        pvName - The PV name
        conversionFuntion -  
        Throws:
        IOException -