nsmcp::AccessRecordSupport method accessRecordCheckpoint (protected)

 <instance of nsmcp::AccessRecordSupport[i]> accessRecordCheckpoint \
    store fid file begin end

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

Parameters:
store (required)
fid (required)
file (required)
begin (required)
end (required)

Testcases:
No testcase defined.
Source code:
set db [$store session]
# Bound fragmented coverage metadata, not the number of batches.
# A batch joining existing coverage is permitted at the limit.
set maxRanges 4096
if {[$db scalar {SELECT count(*) FROM nsmcp_records.ranges WHERE fid=:fid}] >= $maxRanges
    && ![$db scalar {SELECT count(*) FROM nsmcp_records.ranges
        WHERE fid=:fid AND lo<=:end AND hi>=:begin}]} {
    error "record-store-range-limit"
}
set f [open [dict get $file path] rb]
try {
    seek $f [expr {max(0, $end - 64)}]
    set anchor [ns_crypto::md string -digest sha256 -binary -- [read $f [expr {min(64, $end)}]]]
} finally {
    close $f
}
set stamp [dict get $file mtime]
set now [clock seconds]
set dropping [:dict getdef $file dropping 0]
set lo $begin
set hi $end
foreach span [$db execute {SELECT lo,hi,anchor FROM nsmcp_records.ranges
    WHERE fid=:fid AND lo<=:end AND hi>=:begin}] {
    set lo [expr {min($lo, [dict get $span lo])}]
    if {[dict get $span hi] > $hi} {
        set hi [dict get $span hi]
        set anchor [dict get $span anchor]
    }
}
return [dict create begin $begin end $end lo $lo hi $hi anchor $anchor  stamp $stamp now $now dropping $dropping]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: