nsmcp::AccessRecordStoreSQLite method rollupSource (protected)

 <instance of nsmcp::AccessRecordStoreSQLite[i]> rollupSource \
    options

Defined in /usr/local/ns/tcl/nsmcp/log-traffic-record-store.tcl

Parameters:
options (required)

Testcases:
No testcase defined.
Source code:
if {!${:fullScope} || ![dict exists ${:settings} unified] || ![dict get ${:settings} unified] || ![:stateGet rollupsReady 0] || [dict get $options pathLiteral] ne {}} {return {}}
set from [dict get $options from]; set to [dict get $options to]
# Full minutes use the ingestion rollup. Only the disjoint partial
# minutes use the time index; never round the requested window.
set from [expr {max($from,[:retentionFloor])}]
if {$from<0} {return {}}
set lo [expr {wide(ceil($from/60.0))*60}]
set hi [expr {wide(floor($to/60.0))*60}]
set parts {}
if {$lo<$hi} {
    lappend parts "SELECT 0 AS kind,slot AS t,status,pool,method,source,n FROM nsmcp_records.minutes m JOIN temp.nsmcp_record_scope s ON m.fid=s.fid WHERE slot>=$lo AND slot<$hi"
    set edges [list [list $from $lo] [list $hi $to]]
} else {set edges [list [list $from $to]]}
foreach edge $edges {
    lassign $edge start end
    if {$start>=$end} continue
    lappend parts "SELECT kind,t,status,pool,method,source,1 AS n FROM nsmcp_records.rows r INDEXED BY by_time_status JOIN temp.nsmcp_record_scope s ON r.fid=s.fid AND r.off>=s.lo AND r.stop<=s.hi WHERE kind=0 AND t>=[${:db} quote $start] AND t<[${:db} quote $end]"
}
if {![llength $parts]} {return {SELECT 0 AS kind,0 AS t,0 AS status,'' AS pool,'' AS method,'' AS source,0 AS n WHERE 0}}
return [join $parts { UNION ALL }]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: