nsmcp::LogService method poll (public)
<instance of nsmcp::LogService> poll context handle
Defined in /usr/local/ns/tcl/nsmcp/log-tools.tcl
Read the status and progress of an owned log job. Check ownership and report explicit coverage and continuation metadata under the service mutex.
- Parameters:
- context (required)
- Authenticated request context carrying the principal, grants and selected server.
- handle (required)
- Retained job or conversation handle; ownership and expiry checks still apply.
- Returns:
- A rooted JSON job-status object.
- Testcases:
- No testcase defined.
Source code: :require $context ns_mutex lock ${:mutex} try { if {![nsv_exists ${:store} $handle] || ![:owned $context [nsv_get ${:store} $handle]]} { foreach key [nsv_array names ${:store}] { set record [nsv_get ${:store} $key] if {![:owned $context $record]} { continue } if {[dict exists $record mappings $handle]} { return -code error -errorcode {NSMCP RPC -32602} "This is a resultHandle; pass it as resultHandle to read a page" } if {[dict exists $record windowHandle] && [dict get $record windowHandle] eq $handle} { return -code error -errorcode {NSMCP RPC -32602} "This is a windowHandle; use it with access_summary" } } return -code error -errorcode {NSMCP RPC -32602} "Unknown or expired job handle" } set record [nsv_get ${:store} $handle] if {[dict exists $record requiresRuntime] && [dict get $record requiresRuntime]} { ${:authorizer} require $context diagnostics.runtime.read } if {[dict exists $record requiresPeers] && [dict get $record requiresPeers]} { ${:authorizer} require $context diagnostics.logs.peers.read } set data [list jobHandle string $handle status string [dict get $record status] server string [ns_info server]] if {[dict exists $record windowHandle]} { lappend data windowHandle string [dict get $record windowHandle] } if {[dict exists $record progress]} { set showProgress [expr {[dict get $record status] ne "complete"}] foreach {key type value} [dict get $record progress] { if {$key eq "phase"} { set showProgress true } } if {$showProgress} { lappend data progress object [dict get $record progress] } } ::nsmcp::logJobTiming record {} if {[dict exists $record processingTime]} { lappend data processingTime object [dict get $record processingTime] } if {[dict get $record status] eq "complete"} { lappend data result object [dict get $record data] } if {[dict get $record status] eq "failed"} { lappend data error string {Log search failed; consult the server log.} } return [list {} object $data] } finally { ns_mutex unlock ${:mutex} }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)