nsmcp::AccessRecordStoreSQLite method coveredEnd (public)

 <instance of nsmcp::AccessRecordStoreSQLite[i]> coveredEnd fid \
    offset end

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

Find the end of the committed range containing an offset. Use persisted byte coverage rather than reading the source file. Clamp the result to the caller's planned scan boundary.

Parameters:
fid (required)
Stored source-file identifier.
offset (required)
Starting byte offset to test.
end (required)
Upper byte boundary for this scan.
Returns:
The covered end offset, or offset itself when no range covers it.

Testcases:
No testcase defined.
Source code:
set hi [${:db} scalar {
    SELECT coalesce(max(hi),-1) FROM nsmcp_records.ranges WHERE fid=:fid AND lo<=:offset AND hi>:offset
}]
return [expr {$hi<0 ? $offset : min($hi,$end)}]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: