C# Class GSF.Historian.Files.ArchiveFile

Inheritance: System.ComponentModel.Component, IArchive, ISupportLifecycle, ISupportInitialize, IProvideStatus, IPersistSettings
Show file Open project: GridProtectionAlliance/gsf Class Usage Examples

Private Properties

Property Type Description
BeginInit void
BuildHistoricFileList void
CloseStream void
ConserveMemoryTimer_Elapsed void
CurrentDataQueue_ProcessException void
DeleteFile void
EndInit void
FileWatcher_Created void
FileWatcher_Deleted void
FileWatcher_Renamed void
FindHistoricArchiveFileForRead bool
FindHistoricArchiveFileForWrite bool
GetHistoricFileInfo Info
HistoricDataQueue_ProcessException void
InsertInCurrentArchiveFile void
IsNewHistoricArchiveFile bool
MaintainMaximumNumberOfHistoricFiles void
MetadataFile_FileModified void
MoveFile void
OffloadHistoricFiles void
OffloadMaxAgedFiles void
OpenStream void
OutOfSequenceDataQueue_ProcessException void
PrepareForRollover void
ReOpen void
ReadData IEnumerable
SyncStateFile void
WriteToCurrentArchiveFile void
WriteToHistoricArchiveFile void

Public Methods

Method Description
ArchiveFile ( ) : System

Initializes a new instance of the ArchiveFile class.

ArchiveFile ( IContainer container ) : System

Initializes a new instance of the ArchiveFile class.

Close ( ) : void

Closes the ArchiveFile if it IsOpen.

Initialize ( ) : void

Initializes the ArchiveFile.

Initialize() is to be called by user-code directly only if the ArchiveFile is not consumed through the designer surface of the IDE.

LoadSettings ( ) : void

Loads saved settings for the ArchiveFile from the config file if the PersistSettings property is set to true.

MaximumDataBlocks ( double fileSize, int blockSize ) : int

Returns the number of ArchiveDataBlocks an ArchiveFile can have.

Open ( ) : void

Opens the ArchiveFile for use.

ReadData ( IEnumerable historianIDs, DateTime startTime, DateTime endTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( IEnumerable historianIDs, DateTime startTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( IEnumerable historianIDs, TimeTag startTime, TimeTag endTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( IEnumerable historianIDs, TimeTag startTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( IEnumerable historianIDs, bool timeSorted = true ) : IEnumerable

Reads all ArchiveDataPoints from the ArchiveFile for the specified historianIDs.

ReadData ( IEnumerable historianIDs, string startTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( IEnumerable historianIDs, string startTime, string endTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( int historianID, DateTime startTime, DateTime endTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( int historianID, DateTime startTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( int historianID, TimeTag startTime, TimeTag endTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( int historianID, TimeTag startTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( int historianID, bool timeSorted = true ) : IEnumerable

Reads all ArchiveDataPoints from the ArchiveFile for the specified historianID.

ReadData ( int historianID, string startTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadData ( int historianID, string startTime, string endTime, bool timeSorted = true ) : IEnumerable

Reads ArchiveDataPoints from the ArchiveFile.

ReadMetaData ( int historianID ) : byte[]

Reads MetadataRecord for the specified historianID.

ReadMetaDataSummary ( int historianID ) : byte[]

Reads MetadataRecordSummary for the specified historianID.

ReadStateData ( int historianID ) : byte[]

Reads StateRecord for the specified historianID.

ReadStateDataSummary ( int historianID ) : byte[]

Reads StateRecordSummary for the specified historianID.

Rollover ( ) : void

Performs rollover of active ArchiveFile to a new ArchiveFile.

Save ( ) : void

Saves the ArchiveFile.

SaveSettings ( ) : void

Saves settings for the ArchiveFile to the config file if the PersistSettings property is set to true.

SynchronizeStateFile ( ) : void

Requests a resynchronization of the state file.

WriteData ( IDataPoint dataPoint ) : void

Writes the specified dataPoint to the ArchiveFile.

WriteData ( IEnumerable dataPoints ) : void

Writes the specified dataPoints to the ArchiveFile.

WriteMetaData ( int historianID, byte metadata ) : void

Writes metadata for the specified historianID.

WriteStateData ( int historianID, byte statedata ) : void

Writes statedata for the specified historianID.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the ArchiveFile and optionally releases the managed resources.

OnDataReadException ( Exception ex ) : void

Raises the DataReadException event.

OnDataWriteException ( Exception ex ) : void

Raises the DataWriteException event.

OnFileFull ( ) : void

Raises the FileFull event.

OnFutureDataReceived ( IDataPoint dataPoint ) : void

Raises the FutureDataReceived event.

OnHistoricDataReceived ( IDataPoint dataPoint ) : void

Raises the HistoricDataReceived event.

OnHistoricFileListBuildComplete ( ) : void

Raises the HistoricFileListBuildComplete event.

OnHistoricFileListBuildException ( Exception ex ) : void

Raise the HistoricFileListBuildException event.

OnHistoricFileListBuildStart ( ) : void

Raises the HistoricFileListBuildStart event.

OnHistoricFileListUpdated ( ) : void

Raises the HistoricFileListUpdated event.

OnMetadataUpdated ( ) : void

Raises the MetadataUpdated event.

OnOffloadComplete ( ) : void

Raises the OffloadComplete event.

OnOffloadException ( Exception ex ) : void

Raises the OffloadException event.

OnOffloadProgress ( ProcessProgress offloadProgress ) : void

Raises the OffloadProgress event.

OnOffloadStart ( ) : void

Raises the OffloadStart event.

OnOrphanDataReceived ( IDataPoint dataPoint ) : void

Raises the OrphanDataReceived event.

OnOutOfSequenceDataReceived ( IDataPoint dataPoint ) : void

Raises the OutOfSequenceDataReceived event.

OnProcessAlarmNotification ( StateRecord pointState ) : void

Raises the ProcessAlarmNotification event.

OnRolloverComplete ( ) : void

Raises the RolloverComplete event.

OnRolloverException ( Exception ex ) : void

Raises the RolloverException event.

OnRolloverPreparationComplete ( ) : void

Raises the RolloverPreparationComplete event.

OnRolloverPreparationException ( Exception ex ) : void

Raises the RolloverPreparationException event.

OnRolloverPreparationStart ( ) : void

Raises the RolloverPreparationStart event.

OnRolloverStart ( ) : void

Raises the RolloverStart event.

WaitForReadersRelease ( ) : bool

Waits for all readers to relinquish read locks on active file.

Private Methods

Method Description
BeginInit ( ) : void
BuildHistoricFileList ( ) : void
CloseStream ( ) : void
ConserveMemoryTimer_Elapsed ( object sender, System.Timers.ElapsedEventArgs e ) : void
CurrentDataQueue_ProcessException ( object sender, EventArgs e ) : void
DeleteFile ( string fileName ) : void
EndInit ( ) : void
FileWatcher_Created ( object sender, FileSystemEventArgs e ) : void
FileWatcher_Deleted ( object sender, FileSystemEventArgs e ) : void
FileWatcher_Renamed ( object sender, RenamedEventArgs e ) : void
FindHistoricArchiveFileForRead ( System.ComponentModel.Info fileInfo, TimeTag startTime, TimeTag endTime ) : bool
FindHistoricArchiveFileForWrite ( System.ComponentModel.Info fileInfo, TimeTag searchTime ) : bool
GetHistoricFileInfo ( string fileName ) : Info
HistoricDataQueue_ProcessException ( object sender, EventArgs e ) : void
InsertInCurrentArchiveFile ( IDataPoint items ) : void
IsNewHistoricArchiveFile ( Info fileInfo, string fileName ) : bool
MaintainMaximumNumberOfHistoricFiles ( ) : void
MetadataFile_FileModified ( object sender, EventArgs e ) : void
MoveFile ( string sourceFileName, string destinationFileName ) : void
OffloadHistoricFiles ( ) : void
OffloadMaxAgedFiles ( ) : void
OpenStream ( ) : void
OutOfSequenceDataQueue_ProcessException ( object sender, EventArgs e ) : void
PrepareForRollover ( ) : void
ReOpen ( ) : void
ReadData ( IEnumerable historianIDs, TimeTag startTime, TimeTag endTime, IDataPoint resumeFrom, bool timeSorted ) : IEnumerable
SyncStateFile ( object state ) : void
WriteToCurrentArchiveFile ( IDataPoint items ) : void
WriteToHistoricArchiveFile ( IDataPoint items ) : void

Method Details

ArchiveFile() public method

Initializes a new instance of the ArchiveFile class.
public ArchiveFile ( ) : System
return System

ArchiveFile() public method

Initializes a new instance of the ArchiveFile class.
public ArchiveFile ( IContainer container ) : System
container IContainer object that contains the .
return System

Close() public method

Closes the ArchiveFile if it IsOpen.
public Close ( ) : void
return void

Dispose() protected method

Releases the unmanaged resources used by the ArchiveFile and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

Initialize() public method

Initializes the ArchiveFile.
Initialize() is to be called by user-code directly only if the ArchiveFile is not consumed through the designer surface of the IDE.
public Initialize ( ) : void
return void

LoadSettings() public method

Loads saved settings for the ArchiveFile from the config file if the PersistSettings property is set to true.
has a value of null or empty string.
public LoadSettings ( ) : void
return void

MaximumDataBlocks() public static method

Returns the number of ArchiveDataBlocks an ArchiveFile can have.
public static MaximumDataBlocks ( double fileSize, int blockSize ) : int
fileSize double Size (in MB) of the .
blockSize int Size (in KB) of the s in the .
return int

OnDataReadException() protected method

Raises the DataReadException event.
protected OnDataReadException ( Exception ex ) : void
ex Exception to send to event.
return void

OnDataWriteException() protected method

Raises the DataWriteException event.
protected OnDataWriteException ( Exception ex ) : void
ex Exception to send to event.
return void

OnFileFull() protected method

Raises the FileFull event.
protected OnFileFull ( ) : void
return void

OnFutureDataReceived() protected method

Raises the FutureDataReceived event.
protected OnFutureDataReceived ( IDataPoint dataPoint ) : void
dataPoint IDataPoint to send to event.
return void

OnHistoricDataReceived() protected method

Raises the HistoricDataReceived event.
protected OnHistoricDataReceived ( IDataPoint dataPoint ) : void
dataPoint IDataPoint to send to event.
return void

OnHistoricFileListBuildComplete() protected method

Raises the HistoricFileListBuildComplete event.
protected OnHistoricFileListBuildComplete ( ) : void
return void

OnHistoricFileListBuildException() protected method

Raise the HistoricFileListBuildException event.
protected OnHistoricFileListBuildException ( Exception ex ) : void
ex Exception to send to event.
return void

OnHistoricFileListBuildStart() protected method

Raises the HistoricFileListBuildStart event.
protected OnHistoricFileListBuildStart ( ) : void
return void

OnHistoricFileListUpdated() protected method

Raises the HistoricFileListUpdated event.
protected OnHistoricFileListUpdated ( ) : void
return void

OnMetadataUpdated() protected method

Raises the MetadataUpdated event.
protected OnMetadataUpdated ( ) : void
return void

OnOffloadComplete() protected method

Raises the OffloadComplete event.
protected OnOffloadComplete ( ) : void
return void

OnOffloadException() protected method

Raises the OffloadException event.
protected OnOffloadException ( Exception ex ) : void
ex Exception to send to event.
return void

OnOffloadProgress() protected method

Raises the OffloadProgress event.
protected OnOffloadProgress ( ProcessProgress offloadProgress ) : void
offloadProgress ProcessProgress to send to event.
return void

OnOffloadStart() protected method

Raises the OffloadStart event.
protected OnOffloadStart ( ) : void
return void

OnOrphanDataReceived() protected method

Raises the OrphanDataReceived event.
protected OnOrphanDataReceived ( IDataPoint dataPoint ) : void
dataPoint IDataPoint to send to event.
return void

OnOutOfSequenceDataReceived() protected method

Raises the OutOfSequenceDataReceived event.
protected OnOutOfSequenceDataReceived ( IDataPoint dataPoint ) : void
dataPoint IDataPoint to send to event.
return void

OnProcessAlarmNotification() protected method

Raises the ProcessAlarmNotification event.
protected OnProcessAlarmNotification ( StateRecord pointState ) : void
pointState StateRecord to send to event.
return void

OnRolloverComplete() protected method

Raises the RolloverComplete event.
protected OnRolloverComplete ( ) : void
return void

OnRolloverException() protected method

Raises the RolloverException event.
protected OnRolloverException ( Exception ex ) : void
ex Exception to send to event.
return void

OnRolloverPreparationComplete() protected method

Raises the RolloverPreparationComplete event.
protected OnRolloverPreparationComplete ( ) : void
return void

OnRolloverPreparationException() protected method

Raises the RolloverPreparationException event.
protected OnRolloverPreparationException ( Exception ex ) : void
ex Exception to send to event.
return void

OnRolloverPreparationStart() protected method

Raises the RolloverPreparationStart event.
protected OnRolloverPreparationStart ( ) : void
return void

OnRolloverStart() protected method

Raises the RolloverStart event.
protected OnRolloverStart ( ) : void
return void

Open() public method

Opens the ArchiveFile for use.
One or all of the , or properties are not set.
public Open ( ) : void
return void

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( IEnumerable historianIDs, DateTime startTime, DateTime endTime, bool timeSorted = true ) : IEnumerable
historianIDs IEnumerable Historian identifiers for which s are to be retrieved.
startTime DateTime Start (in UTC) for the s to be retrieved.
endTime DateTime End (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( IEnumerable historianIDs, DateTime startTime, bool timeSorted = true ) : IEnumerable
historianIDs IEnumerable Historian identifiers for which s are to be retrieved.
startTime DateTime Start (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( IEnumerable historianIDs, TimeTag startTime, TimeTag endTime, bool timeSorted = true ) : IEnumerable
historianIDs IEnumerable Historian identifiers for which s are to be retrieved.
startTime TimeTag Start (in UTC) for the s to be retrieved.
endTime TimeTag End (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( IEnumerable historianIDs, TimeTag startTime, bool timeSorted = true ) : IEnumerable
historianIDs IEnumerable Historian identifiers for which s are to be retrieved.
startTime TimeTag Start (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads all ArchiveDataPoints from the ArchiveFile for the specified historianIDs.
public ReadData ( IEnumerable historianIDs, bool timeSorted = true ) : IEnumerable
historianIDs IEnumerable Historian identifiers for which s are to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( IEnumerable historianIDs, string startTime, bool timeSorted = true ) : IEnumerable
historianIDs IEnumerable Historian identifiers for which s are to be retrieved.
startTime string representation of the start time (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( IEnumerable historianIDs, string startTime, string endTime, bool timeSorted = true ) : IEnumerable
historianIDs IEnumerable Historian identifiers for which s are to be retrieved.
startTime string representation of the start time (in UTC) for the s to be retrieved.
endTime string representation of the end time (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( int historianID, DateTime startTime, DateTime endTime, bool timeSorted = true ) : IEnumerable
historianID int Historian identifier for which s are to be retrieved.
startTime DateTime Start (in UTC) for the s to be retrieved.
endTime DateTime End (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( int historianID, DateTime startTime, bool timeSorted = true ) : IEnumerable
historianID int Historian identifier for which s are to be retrieved.
startTime DateTime Start (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( int historianID, TimeTag startTime, TimeTag endTime, bool timeSorted = true ) : IEnumerable
historianID int Historian identifier for which s are to be retrieved.
startTime TimeTag Start (in UTC) for the s to be retrieved.
endTime TimeTag End (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( int historianID, TimeTag startTime, bool timeSorted = true ) : IEnumerable
historianID int Historian identifier for which s are to be retrieved.
startTime TimeTag Start (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads all ArchiveDataPoints from the ArchiveFile for the specified historianID.
public ReadData ( int historianID, bool timeSorted = true ) : IEnumerable
historianID int Historian identifier for which s are to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( int historianID, string startTime, bool timeSorted = true ) : IEnumerable
historianID int Historian identifier for which s are to be retrieved.
startTime string representation of the start time (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadData() public method

Reads ArchiveDataPoints from the ArchiveFile.
public ReadData ( int historianID, string startTime, string endTime, bool timeSorted = true ) : IEnumerable
historianID int Historian identifier for which s are to be retrieved.
startTime string representation of the start time (in UTC) for the s to be retrieved.
endTime string representation of the end time (in UTC) for the s to be retrieved.
timeSorted bool Indicates whether the data retrieved from the archive should be time sorted.
return IEnumerable

ReadMetaData() public method

Reads MetadataRecord for the specified historianID.
public ReadMetaData ( int historianID ) : byte[]
historianID int Historian identifier.
return byte[]

ReadMetaDataSummary() public method

Reads MetadataRecordSummary for the specified historianID.
public ReadMetaDataSummary ( int historianID ) : byte[]
historianID int Historian identifier.
return byte[]

ReadStateData() public method

Reads StateRecord for the specified historianID.
public ReadStateData ( int historianID ) : byte[]
historianID int Historian identifier.
return byte[]

ReadStateDataSummary() public method

Reads StateRecordSummary for the specified historianID.
public ReadStateDataSummary ( int historianID ) : byte[]
historianID int Historian identifier.
return byte[]

Rollover() public method

Performs rollover of active ArchiveFile to a new ArchiveFile.
is not .
public Rollover ( ) : void
return void

Save() public method

Saves the ArchiveFile.
is not open.
public Save ( ) : void
return void

SaveSettings() public method

Saves settings for the ArchiveFile to the config file if the PersistSettings property is set to true.
has a value of null or empty string.
public SaveSettings ( ) : void
return void

SynchronizeStateFile() public method

Requests a resynchronization of the state file.
public SynchronizeStateFile ( ) : void
return void

WaitForReadersRelease() protected method

Waits for all readers to relinquish read locks on active file.
protected WaitForReadersRelease ( ) : bool
return bool

WriteData() public method

Writes the specified dataPoint to the ArchiveFile.
public WriteData ( IDataPoint dataPoint ) : void
dataPoint IDataPoint to be written.
return void

WriteData() public method

Writes the specified dataPoints to the ArchiveFile.
public WriteData ( IEnumerable dataPoints ) : void
dataPoints IEnumerable points to be written.
return void

WriteMetaData() public method

Writes metadata for the specified historianID.
public WriteMetaData ( int historianID, byte metadata ) : void
historianID int Historian identifier.
metadata byte data.
return void

WriteStateData() public method

Writes statedata for the specified historianID.
public WriteStateData ( int historianID, byte statedata ) : void
historianID int Historian identifier.
statedata byte data.
return void