Class PBAppendDataStateData
java.lang.Object
edu.stanford.slac.archiverappliance.plain.AppendDataStateData
edu.stanford.slac.archiverappliance.plain.pb.PBAppendDataStateData
Companion class to PlainStoragePlugin that handles the appending of event streams in a partition-aware fashion.
This is used both by the engine and by ETL.
- Author:
- mshankar
-
Field Summary
FieldsFields inherited from class edu.stanford.slac.archiverappliance.plain.AppendDataStateData
currentEventsYear, desc, lastKnownTimeStamp, partitionGranularity, previousFilePath, previousYear, pv2key, rootFolder, writer -
Constructor Summary
ConstructorsConstructorDescriptionPBAppendDataStateData(PartitionGranularity partitionGranularity, String rootFolder, String desc, Instant lastKnownTimestamp, PVNameToKeyMapping pv2key, PathResolver pathResolver) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbulkAppend(String pvName, ETLContext context, ETLBulkStream bulkStream, String extension, String extensionToCopyFrom) Append data in bulk skipping some of the per event checks.protected EventFileWritercreateNewWriter(String pvName, Path pvPath, EventStream stream) Append data into PB files honoring partition boundaries switching into new partitions as we cross the boundary.toString()voidupdateStateBasedOnExistingFile(String pvName, Path pvPath) Methods inherited from class edu.stanford.slac.archiverappliance.plain.AppendDataStateData
checkStream, closeStreams, getPathResolver, partitionBoundaryAwareAppendData, preparePartition, shouldISkipEventBasedOnTimeStamps, shouldISwitchPartitions
-
Field Details
-
BULK_BUFFER_INITIAL_CAPACITY
public static final int BULK_BUFFER_INITIAL_CAPACITY- See Also:
-
-
Constructor Details
-
PBAppendDataStateData
public PBAppendDataStateData(PartitionGranularity partitionGranularity, String rootFolder, String desc, Instant lastKnownTimestamp, PVNameToKeyMapping pv2key, PathResolver pathResolver) - Parameters:
partitionGranularity- partitionGranularity of the PB plugin.rootFolder- RootFolder of the PB plugindesc- Desc for logging purposeslastKnownTimestamp- This is probably the most important argument here. This is the last known timestamp in this storage. If null, we assume time(0) for the last known timestamp.pv2key- PVNameToKeyMapping
-
-
Method Details
-
createNewWriter
protected EventFileWriter createNewWriter(String pvName, Path pvPath, EventStream stream) throws IOException Append data into PB files honoring partition boundaries switching into new partitions as we cross the boundary.- We make sure timestamp monotonicity is maintained.
- We generate clean partitions.
- Specified by:
createNewWriterin classAppendDataStateData- Parameters:
pvName- The PV namestream-- Returns:
- eventsAppended
- Throws:
IOException-
-
updateStateBasedOnExistingFile
- Specified by:
updateStateBasedOnExistingFilein classAppendDataStateData- Throws:
IOException
-
toString
-
bulkAppend
public boolean bulkAppend(String pvName, ETLContext context, ETLBulkStream bulkStream, String extension, String extensionToCopyFrom) throws IOException Append data in bulk skipping some of the per event checks.- Specified by:
bulkAppendin classAppendDataStateData- Parameters:
pvName- The PV namecontext- The ETL contextbulkStream- The ETL bulk streamextension-extensionToCopyFrom-- Returns:
- boolean
- Throws:
IOException-
-