CutRevisions(
FromRevision: Integer;
ToRevision: Integer;
SaveLabels: Boolean;
[RemoveDeleted: Boolean = False]);
CutRevisions(
FromRevision: uinteger;
ToRevision: uinteger;
SaveLabels: boolean;
RemoveDeleted: boolean);
FromRevision. Key of the first revision in the compressed range. If the parameter takes "-1" value, the compression is executed from the first revision in the time series database.
ToRevision. Key of the last revision in the compressed range.
SaveLabels. Indicates whether the labels in the specified revision range is saved. If the parameter value is True, the range of compressed revisions is divided into parts ending with a label. In each part revision compression is executed, all the labels are saved. If the value is set to False, all revisions in the specified range are compressed regardless of labels, the labels are not saved.
RemoveDeleted. Indicates whether data of deleted time series is stored. False - default value. Save data if time series are deleted. True - data of the deleted series are not saved. The True value can only be specified if FromRevision = -1 and ToRevision = last revision. Optional parameter.
The CutRevisions data compresses the specified revision range.
Revisions compression may be required if the time series database is no longer up-to-date, but must be kept, however, it is not necessary to store data of all the revisions.
Executing the example requires that the repository contains a time series database with the TSDB identifier.
Add links to the Cubes, Dimensions, Metabase, Rds system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Rub: IRubricator;
RubI: IRubricatorInstance;
LastRevKey: Integer;
RevLookup: IMetaDictionaryLookup;
Current: IMetaDictionaryData;
Begin
Mb := MetabaseClass.Active;
Rub := Mb.ItemById("TSDB").Bind As IRubricator;
RubI := (Rub As IMetabaseObject).Open(Null) As IRubricatorInstance;
RevLookup := RubI.Revisions.CreateLookup("KEY");
RevLookup.Open(DictionaryCursorOptions.None);
LastRevKey := -1;
While Not RevLookup.Eof Do
Current := RevLookup.Current;
If LastRevKey < Current.Record.Key Then
LastRevKey := Current.Record.Key;
End If;
RevLookup.Next;
End While;
RevLookup.Close;
RubI.CutRevisions(-1, LastRevKey, False, True);
End Sub UserProc;
After executing the example all revisions are compressed without saving data of deleted time series and metrics.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
Rub: IRubricator;
RubI: IRubricatorInstance;
LastRevKey: uinteger;
RevLookup: IMetaDictionaryLookup;
Current: IMetaDictionaryData;
Begin
Mb := Params.Metabase;
Rub := Mb.ItemById["TSDB"].Bind() As IRubricator;
RubI := (Rub As IMetabaseObject).Open(Null) As IRubricatorInstance;
RevLookup := RubI.Revisions.CreateLookup("KEY");
RevLookup.Open(DictionaryCursorOptions.dcuoNone);
LastRevKey := 0;
While Not RevLookup.Eof() Do
Current := RevLookup.Current;
If LastRevKey < Current.Record.Key Then
LastRevKey := Current.Record.Key;
End If;
RevLookup.Next();
End While;
RevLookup.Close();
RubI.CutRevisions(1, LastRevKey, False, True);
End Sub;
See also: