nsmcp::AccessRecordStoreSQLite method prune (public)
<instance of nsmcp::AccessRecordStoreSQLite> prune [ batchRows ]
Defined in /usr/local/ns/tcl/nsmcp/log-traffic-record-store.tcl
Apply the configured retention policy to a writable store. Unified stores remove bounded batches of expired records and related metadata. They require an idle session and own their transaction. A connection-local candidate table is reused for selection/accounting and exact-ID deletion; it is removed after success or rollback without changing other temporary objects. Other stores expire whole source generations so retained coverage cannot certify deleted requests.
- Parameters:
- batchRows (optional, defaults to
"10000")- Maximum metadata rows per deletion, from 1 through 10000. Partitioned stores also drop at most one expired request table per transaction; that table can contain more than batchRows requests.
- Returns:
- Deletion counts for unified retention, or an empty result for generation retention.
- Testcases:
- No testcase defined.
Source code: if {[:dict getdef ${:settings} unified false]} { if {${:partitionInterval}>0} { return [:partitionPrune $batchRows] } return [:pruneAge $batchRows] } # Expire whole source generations, not individual rows/ranges: keeping # a range after deleting its rows would falsely certify cached coverage. set cutoff [expr {[clock seconds]-[dict get ${:settings} retention]}] ${:db} transaction { ${:db} execute { DELETE FROM main.rows WHERE fid IN (SELECT fid FROM main.files WHERE touched<:cutoff); DELETE FROM main.ranges WHERE fid IN (SELECT fid FROM main.files WHERE touched<:cutoff); DELETE FROM main.scan_counts WHERE fid IN (SELECT fid FROM main.files WHERE touched<:cutoff); DELETE FROM main.files WHERE touched<:cutoff } }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)