From 8468a9354afda0a8d76d827bd8eaf3b318f92ddd Mon Sep 17 00:00:00 2001 From: Igor Sfiligoi Date: Thu, 7 Nov 2013 21:15:36 +0000 Subject: Add options to RRDFile and RRFileSum, and use thim in the Async classes --- src/lib/rrdMultiFile.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/lib/rrdMultiFile.js') diff --git a/src/lib/rrdMultiFile.js b/src/lib/rrdMultiFile.js index 1e2af85..c591aad 100644 --- a/src/lib/rrdMultiFile.js +++ b/src/lib/rrdMultiFile.js @@ -107,11 +107,29 @@ function rrdFileSort(f1, f2) { * They must all have the same DSes and the same RRAs */ -function RRDFileSum(file_list,treat_undefined_as_zero) { - if (treat_undefined_as_zero==undefined) { + +/* + * sumfile_options, if defined, must be an object containing any of these + * treat_undefined_as_zero + * + */ + +// For backwards comatibility, if sumfile_options is a boolean, +// it is interpreted like the "old treat_undefined_as_zero" argument + +function RRDFileSum(file_list,sumfile_options) { + if (sumfile_options==undefined) { + sumfile_options={}; + } elif (typeof(sumfile_options)=="boolean") { + sumfile_options={treat_undefined_as_zero:sumfile_options}; + } + this.sumfile_options=sumfile_options; + + + if (this.sumfile_options.treat_undefined_as_zero==undefined) { this.treat_undefined_as_zero=true; - } else { - this.treat_undefined_as_zero=treat_undefined_as_zero; + } else { + this.treat_undefined_as_zero=this.sumfile_options.treat_undefined_as_zero; } this.file_list=file_list; this.file_list.sort(); -- cgit v1.2.3-54-g00ecf