nsmcp::AccessLogIngestor method sample (protected)

 <instance of nsmcp::AccessLogIngestor[i]> sample f position length

Defined in /usr/local/ns/tcl/nsmcp/lib/access-analytics.tcl

Parameters:
f (required)
position (required)
length (required)

Testcases:
No testcase defined.
Source code:
seek $f $position
set bytes [read $f $length]
set start 0
if {$position > 0} {
    set newline [string first \n $bytes]
    if {$newline < 0} {return {}}
    set start [expr {$newline+1}]
}
# Skip malformed/oversized physical rows without unbounded probing.
for {set i 0} {$i < 64} {incr i} {
    set end [string first \n $bytes $start]
    if {$end < 0} break
    if {$end-$start <= ${:maxLineBytes}} {
        set line [encoding convertfrom utf-8 [string range $bytes $start [expr {$end-1}]]]
        set time [${:parser} completionTime $line]
        if {$time ne ""} {return [list [expr {$position+$start}] $time]}
    }
    set start [expr {$end+1}]
}
return {}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: