nsmcp::AccessDiagnosticTool method contextComplete (public)

 <instance of nsmcp::AccessDiagnosticTool[i]> contextComplete record \
    snapshot

Defined in /usr/local/ns/tcl/nsmcp/traffic-tools.tcl

Check whether recorded fields suffice for the routing snapshot. Inspect unavailable topology data and map conditions before claiming a complete request context.

Parameters:
record (required)
Recorded request fields or routing-evidence dictionary.
snapshot (required)
Routing snapshot with availability metadata.
Returns:
True when the recorded context supports the required lookup, otherwise false.

Testcases:
No testcase defined.
Source code:
if {[dict size [dict get $snapshot availability]]>0} {
    return false
}
dict for {pool maps} [dict get $snapshot pools] {
    foreach map $maps {
        if {[llength $map] ni {4 5}} {
            return false
        }
        if {[lindex $map 0] ne [dict get $record method]} {
            continue
        }
        if {[llength $map]==4} {
            continue
        }
        set condition [lindex $map 4]
        if {[llength $condition]%2} {
            return false
        }
        foreach {field pattern} $condition {
            switch -nocase -- $field {
                user-agent {
                    if {![dict exists $record userAgent] || [dict get $record userAgent] in {{} - {[REDACTED]}}} {
                        return false
                    }
                }
                x-ns-ip {
                    if {![ns_ip valid [dict get $record peerAddress]]} {
                        return false
                    }
                }
                default {
                    return false
                }
            }
        }
    }
}
return true
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: