From 67fd09791fc39ebb0875c26272889a5f1c5484c3 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Tue, 3 Nov 2020 15:28:41 +0100 Subject: [PATCH] create prune simulator A stand-alone ExtJS app that allows experimenting with different backup schedules and prune parameters. The HTML for the documentation was taken from the PBS docs and adapted to the context of the simulator. For performance reasons, the week table does not use subcomponents, but raw HTML. Signed-off-by: Fabian Ebner --- docs/prune-simulator/documentation.html | 73 +++ docs/prune-simulator/index.html | 13 + docs/prune-simulator/prune-simulator.js | 755 ++++++++++++++++++++++++ 3 files changed, 841 insertions(+) create mode 100644 docs/prune-simulator/documentation.html create mode 100644 docs/prune-simulator/index.html create mode 100644 docs/prune-simulator/prune-simulator.js diff --git a/docs/prune-simulator/documentation.html b/docs/prune-simulator/documentation.html new file mode 100644 index 00000000..2bd90b94 --- /dev/null +++ b/docs/prune-simulator/documentation.html @@ -0,0 +1,73 @@ + + + + + + +

A simulator to experiment with different backup schedules and prune +options.

+ +

Schedule

+

Select weekdays with the combobox and input hour and minute +specification separated by a colon, i.e. HOUR:MINUTE. Each of +HOUR and MINUTE can be either a single value or +one of the following:

+ + +

Pruning

+

Prune lets you systematically delete older backups, retaining backups for +the last given number of time intervals. The following retention options are +available:

+
+
keep-last <N>
+
Keep the last <N> backup snapshots.
+
keep-hourly <N>
+
Keep backups for the last <N> hours. If there is more than one +backup for a single hour, only the latest is kept.
+
keep-daily <N>
+
Keep backups for the last <N> days. If there is more than one +backup for a single day, only the latest is kept.
+
keep-weekly <N>
+
Keep backups for the last <N> weeks. If there is more than one +backup for a single week, only the latest is kept. +
+

Note: Weeks start on Monday and end on Sunday. The software +uses the ISO week date system and handles weeks at +the end of the year correctly.

+
+
+
keep-monthly <N>
+
Keep backups for the last <N> months. If there is more than one +backup for a single month, only the latest is kept.
+
keep-yearly <N>
+
Keep backups for the last <N> years. If there is more than one +backup for a single year, only the latest is kept.
+
+

The retention options are processed in the order given above. Each option +only covers backups within its time period. The next option does not take care +of already covered backups. It will only consider older backups.

+

For example, in a week covered by keep-weekly, one backup is +kept while all others are removed; keep-monthly then does not +consider backups from that week anymore, even if part of the week is part of +an earlier month.

+ + diff --git a/docs/prune-simulator/index.html b/docs/prune-simulator/index.html new file mode 100644 index 00000000..22fa66f6 --- /dev/null +++ b/docs/prune-simulator/index.html @@ -0,0 +1,13 @@ + + + + + + PBS Prune Simulator + + + + + + + diff --git a/docs/prune-simulator/prune-simulator.js b/docs/prune-simulator/prune-simulator.js new file mode 100644 index 00000000..505eb852 --- /dev/null +++ b/docs/prune-simulator/prune-simulator.js @@ -0,0 +1,755 @@ +// avoid errors when running without development tools +if (!Ext.isDefined(Ext.global.console)) { + var console = { + dir: function() {}, + log: function() {}, + }; +} + +Ext.onReady(function() { + const NOW = new Date(); + const COLORS = { + 'keep-last': 'orange', + 'keep-hourly': 'purple', + 'keep-daily': 'yellow', + 'keep-weekly': 'green', + 'keep-monthly': 'blue', + 'keep-yearly': 'red', + 'all zero': 'white', + }; + const TEXT_COLORS = { + 'keep-last': 'black', + 'keep-hourly': 'white', + 'keep-daily': 'black', + 'keep-weekly': 'white', + 'keep-monthly': 'white', + 'keep-yearly': 'white', + 'all zero': 'black', + }; + + Ext.define('PBS.prunesimulator.Documentation', { + extend: 'Ext.Panel', + alias: 'widget.prunesimulatorDocumentation', + + html: '