From b3e8ca117ab962cf787a99504c3f1f3160d51d3e Mon Sep 17 00:00:00 2001 From: Sean Beckett Date: Tue, 30 Aug 2016 16:56:52 -0600 Subject: [PATCH 1/3] moving docs #624 to kap --- pipeline/window.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pipeline/window.go b/pipeline/window.go index f723bcffd..b82b29bc4 100644 --- a/pipeline/window.go +++ b/pipeline/window.go @@ -39,9 +39,12 @@ func newWindowNode() *WindowNode { } } -// Wether to align the window edges with the zero time. -// If not aligned the window starts and ends relative to the -// first data point it receives. +// If the `align` property is not used to modify the `window` node, then the +// window alignment is assumed to start at the time of the first data point it receives. +// If `align` property is used to modify the `window` node, the window time edges +// will be truncated to the `every` property (For example, if a data point's time +// is 12:06 and the `every` property is `5m` then the data point's window will range +// from 12:05 to 12:10). // tick:property func (w *WindowNode) Align() *WindowNode { w.AlignFlag = true From 68148e2f95462f1996fdf8fdf3faf8b28b328fe9 Mon Sep 17 00:00:00 2001 From: Sean Beckett Date: Tue, 30 Aug 2016 16:59:37 -0600 Subject: [PATCH 2/3] Update window.go --- pipeline/window.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pipeline/window.go b/pipeline/window.go index b82b29bc4..36d9d478e 100644 --- a/pipeline/window.go +++ b/pipeline/window.go @@ -4,9 +4,15 @@ import ( "time" ) -// Windows data over time. -// A window has a length defined by `period` -// and a frequency at which it emits the window to the pipeline. +// A `window` node caches data within a moving time range. +// The `period` property of `window` defines the time range covered by `window`. +// +// The `every` property of `window` defines the frequency at which the window +// is emitted to the next node in the pipeline. +// +//The `align` property of `window` defines how to align the window edges. +//(By default, the edges are defined relative to the first data point the `window` +//node receives.) // // Example: // stream @@ -15,13 +21,11 @@ import ( // .every(5m) // |httpOut('recent') // -// The above windowing example emits a window to the pipeline every `5 minutes` -// and the window contains the last `10 minutes` worth of data. -// As a result each time the window is emitted it contains half new data and half old data. +// his example emits the last `10 minute` period every `5 minutes` to the pipeline's `httpOut` node. +// Because `every` is less than `period`, each time the window is emitted it contains `5 minutes` of +// new data and `5 minutes` of the previous period's data. // -// NOTE: Time for a window (or any node) is implemented by inspecting the times on the incoming data points. -// As a result if the incoming data stream stops then no more windows will be emitted because time is no longer -// increasing for the window node. +// NOTE: Because no `align` property is defined, the `window` edge is defined relative to the first data point. type WindowNode struct { chainnode // The period, or length in time, of the window. From f0039260de9702afa87c2b2fe0742f684bb47990 Mon Sep 17 00:00:00 2001 From: Sean Beckett Date: Tue, 30 Aug 2016 17:38:28 -0600 Subject: [PATCH 3/3] Update window.go --- pipeline/window.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/window.go b/pipeline/window.go index 36d9d478e..23750eded 100644 --- a/pipeline/window.go +++ b/pipeline/window.go @@ -45,7 +45,7 @@ func newWindowNode() *WindowNode { // If the `align` property is not used to modify the `window` node, then the // window alignment is assumed to start at the time of the first data point it receives. -// If `align` property is used to modify the `window` node, the window time edges +// If `align` property is set, the window time edges // will be truncated to the `every` property (For example, if a data point's time // is 12:06 and the `every` property is `5m` then the data point's window will range // from 12:05 to 12:10).