nsmcp::RequestRoutingTool method encodeSnapshot (public)
<instance of nsmcp::RequestRoutingTool> encodeSnapshot snapshot
Defined in /usr/local/ns/tcl/nsmcp/traffic-tools.tcl
Encode a routing snapshot as typed JSON fields. Retain route order and availability metadata while converting Tcl containers to arrays and objects.
- Parameters:
- snapshot (required)
- Routing snapshot with availability metadata.
- Returns:
- The field triples for the encoded routing snapshot.
- Testcases:
- No testcase defined.
Source code: set pools {} dict for {pool maps} [dict get $snapshot pools] { set rows {} set i 0 foreach row $maps { lappend rows $i string [${:redactor} message $row] incr i } lappend pools $pool array $rows } set filters {} set i 0 foreach row [dict get $snapshot filters] { lappend filters $i string [${:redactor} message $row] incr i } set errors {} dict for {key value} [dict get $snapshot availability] { lappend errors $key string $value } return [list mappings object $pools filters array $filters availability object $errors]XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)