Class ArchiveChannel
java.lang.Object
org.epics.archiverappliance.engine.model.ArchiveChannel
- Direct Known Subclasses:
DeltaArchiveChannel,MonitoredArchiveChannel,ScannedArchiveChannel
Base for archived channels. An ArchiveChannel has
- A main PV; in the typical case, this would be the PV for the .VAL. The record processing timestamp from this PV constitutes identity.
- A optional collection of metadata/field PVs. Data from these PV's is stored as part of the mainPV.
- A SampleBuffer where the data from the main PV is stored.
- A Writer, typically the STS, where the data in the SampleBuffer is periodically flushed.
- Version:
- Initial version:CSS, 4-Jun-2012, Luofeng Li:added codes to support for the new archiver
- Author:
- Kay Kasemir
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBRTimeEventThe last DBRTimeEvent written to the archive.protected DBRTimeEventThe latest DBRTimeEvent received from the control systemprotected final PVMetricspvMetrics for this channel.static final int -
Constructor Summary
ConstructorsConstructorDescriptionArchiveChannel(String name, Writer writer, int buffer_capacity, Instant last_archived_timestamp, ConfigService configservice, ArchDBRTypes archdbrtype, String controlPVname, int commandThreadID, boolean usePVAccess) create archive channel -
Method Summary
Modifier and TypeMethodDescriptionvoidaboutToWriteBuffer(DBRTimeEvent lastSample) protected final voidaddValueToBuffer(DBRTimeEvent timeevent) Add given sample to buffer, performing a back-in-time check, updating the sample buffer error state.intGet the number of connected field channelsif this channel is started or stopped archiving by a another pv, return the pv's nameGet the current value of all the meta fields.intfinal DBRTimeEventCombine the metadata from various sources and return the latest copy.voidgetLowLevelChannelStateInfo(List<Map<String, String>> statuses) abstract StringintNumber of field names for which we have established channels.Get the field names for which we have established channels.final StringgetName()get the combined ArrayListEventStream of prevouse and currentget pv metrics for this channelfinal SampleBufferlongReturn the amount of time (in seconds) since we asked CAJ/JCA to connect to this channel.get the writer for this channelprotected voidHandle a disconnect event.protected booleanhandleNewValue(DBRTimeEvent timeevent) Called for each value received from PV.voidinitializeMetaFieldPVS(String[] metaFields, ConfigService configservice, boolean usePVAccess, boolean useDBEProperties) final booleanbooleanisMetaPVConnected(String metaFieldName) Get the archive channel for a particular metachannel.booleanisPaused()booleanDo any of the meta channels in this PV need starting up?voidreset()Reset countersvoidsetlastRotateLogsEpochSeconds(long lastRotateLogsEpochSecond) set the time stamp of the last value is stored in short term storagevoidsetPaused(boolean pausedVal) voidfinal voidstart()Start archiving this channel.voidStart the metachannelsfinal voidstop()Stop archiving this channeltoString()voidupdateMetadataOnceADay(EngineContext context) Use this method to do a caget on the metadata..
-
Field Details
-
SAVE_META_DATA_PERIOD_SECS
public static final int SAVE_META_DATA_PERIOD_SECS- See Also:
-
pvMetrics
pvMetrics for this channel. Ideally, we should move all metrics to this class. -
latestDBRTimeEvent
The latest DBRTimeEvent received from the control system -
lastDBRTimeEvent
The last DBRTimeEvent written to the archive.
-
-
Constructor Details
-
ArchiveChannel
public ArchiveChannel(String name, Writer writer, int buffer_capacity, Instant last_archived_timestamp, ConfigService configservice, ArchDBRTypes archdbrtype, String controlPVname, int commandThreadID, boolean usePVAccess) throws Exception create archive channel- Parameters:
name- pv's namewriter- the writer for this pvbuffer_capacity- the sample buffer's capacity for this pvlast_archived_timestamp- the last time stamp when this pv was archivedconfigservice- the configservice of new archiverarchdbrtype- the archiving dbr typecontrolPVname- the pv's name who control this pv to start archiving or stop archivingcommandThreadID- - this is the index into the array of JCA command threads that processes this context.usePVAccess- - Should we use PVAccess to connect to this PV.- Throws:
Exception- error when creating archive channel for this pv
-
-
Method Details
-
getControlPVname
if this channel is started or stopped archiving by a another pv, return the pv's name- Returns:
- the pv's name who control this channel archiving
-
setlastRotateLogsEpochSeconds
public void setlastRotateLogsEpochSeconds(long lastRotateLogsEpochSecond) set the time stamp of the last value is stored in short term storage- Parameters:
lastRotateLogsEpochSecond- the time stamp of last value and it is the number of milliseconds since 1970/01/01
-
getWriter
get the writer for this channel- Returns:
- the writer for this channel
-
getPVMetrics
get pv metrics for this channel- Returns:
- PVMetrics
-
initializeMetaFieldPVS
public void initializeMetaFieldPVS(String[] metaFields, ConfigService configservice, boolean usePVAccess, boolean useDBEProperties) throws IOException - Throws:
IOException
-
getPVData
get the combined ArrayListEventStream of prevouse and current- Returns:
- ArrayListEventStream
-
getName
- Returns:
- Name of channel
-
getMechanism
- Returns:
- Short description of sample mechanism
-
isConnected
public final boolean isConnected()- Returns:
trueif connected
-
start
Start archiving this channel.- Throws:
Exception-
-
stop
Stop archiving this channel- Throws:
Exception-
-
getLastArchivedValue
- Returns:
- Last value written to archive
-
getSampleBuffer
- Returns:
- Sample buffer
-
reset
public void reset()Reset counters -
handleNewValue
Called for each value received from PV.Base class remembers the
most_recent_value, and asserts that one 'first' sample is archived. Derived class must callsuper().- Parameters:
timeevent- DBRTimeEvent- Returns:
- true if the value was already written because it's the first value after startup or error, so there's no need to write that sample again.
- Throws:
Exception-
-
startUpMetaChannels
Start the metachannels- Throws:
Exception-
-
shutdownMetaChannels
public void shutdownMetaChannels() -
handleDisconnected
protected void handleDisconnected()Handle a disconnect event.Base class clears the
most_recent_valueand adds a 'disconnected' info sample. Subclasses may override, but must callsuper(). -
addValueToBuffer
Add given sample to buffer, performing a back-in-time check, updating the sample buffer error state.- Parameters:
timeevent- DBRTimeEvent
-
toString
-
getCurrentCopyOfMetaFields
Get the current value of all the meta fields.- Returns:
- - Can return null if this PV has no meta fields.
-
getHostName
-
getLowLevelChannelStateInfo
-
isMetaPVConnected
Get the archive channel for a particular metachannel.- Parameters:
metaFieldName-- Returns:
- boolean True or False
-
getMetaPVNames
Get the field names for which we have established channels.- Returns:
- String the Meta PV names
-
getMetaChannelCount
public int getMetaChannelCount()Number of field names for which we have established channels.- Returns:
- int
-
getConnectedMetaChannelCount
public int getConnectedMetaChannelCount()Get the number of connected field channels- Returns:
- int
-
metaChannelsNeedStartingUp
public boolean metaChannelsNeedStartingUp()Do any of the meta channels in this PV need starting up?- Returns:
- boolean True or False
-
getSecondsElapsedSinceSearchRequest
public long getSecondsElapsedSinceSearchRequest()Return the amount of time (in seconds) since we asked CAJ/JCA to connect to this channel.- Returns:
- long
-
getJCACommandThreadID
public int getJCACommandThreadID()- Returns:
- int the jCACommandThreadID
-
updateMetadataOnceADay
Use this method to do a caget on the metadata..- Parameters:
context- EngineContext
-
getLatestMetadata
Combine the metadata from various sources and return the latest copy.- Returns:
- HashMap
-
aboutToWriteBuffer
-
setPaused
public void setPaused(boolean pausedVal) -
isPaused
public boolean isPaused()
-