nsmcp::accessScanDiscover
nsmcp::accessScanDiscover
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set files {} set identities {} set omitted 0 set unavailable 0 set ignored 0 set candidates {} set rotated {} set source 0 foreach path $paths { # Reserve current files before rotations, even with multiple sources. if {[llength $candidates]<$maxFiles} { lappend candidates [list $path $source false] } else { incr omitted } if {$rotations} { # glob only lists the configured basename's siblings. Retain at most # maxFiles rotation candidates, preferring recently modified files. set base [file tail $path] set pattern [string map {\\ \\\\ [ \\[ ] \\] * \\* ? \\?} $base] if {[catch { glob -nocomplain -directory [file dirname $path] -- $pattern.* } siblings]} { incr unavailable set siblings {} } foreach candidate $siblings { set suffix [string range [file tail $candidate] [expr {[string length $base]+1}] end] if {![regexp {^[0-9][0-9T_.:-]*(?:\.gz)?$} $suffix]} { incr ignored continue } if {[catch { file lstat $candidate st }]} { incr unavailable continue } if {$st(type) ne "file"} { incr ignored continue } lappend rotated [list $st(mtime) $candidate $source] set rotated [lsort -integer -decreasing -index 0 $rotated] if {[llength $rotated]>$maxFiles} { set rotated [lrange $rotated 0 [expr {$maxFiles-1}]] incr omitted } } } incr source } foreach entry $rotated { lassign $entry mtime path source lappend candidates [list $path $source true] } foreach candidate $candidates { lassign $candidate filename source rotation if {[catch { file stat $filename st }]} { incr unavailable continue } set identity [list $st(dev) $st(ino)] if {$identity in $identities} { continue } if {[llength $files]>=$maxFiles} { incr omitted continue } if {[catch { accessScanSnapshot $filename $source $rotation } snapshot]} { incr unavailable continue } lappend identities [dict get $snapshot identity] dict set snapshot fileIndex [llength $files] lappend files $snapshot } return [dict create files $files omittedFiles $omitted unavailableFiles $unavailable ignoredCandidates $ignored]XQL Not present: Generic, PostgreSQL, Oracle