/// Spawn an instance `fidl_fuchsia_diagnostics/Archive` that allows clients to open
/// reader session to diagnostics data.
Spawn an instance `fidl_fuchsia_diagnostics/Archive` that allows clients to open
reader session to diagnostics data.
Spawn an instance ` fidl_fuchsia_diagnostics / Archive ` that allows clients to open reader session to diagnostics data .
pub fn spawn_server(
        self,
        mut stream: ArchiveAccessorRequestStream,
        task_sender: UnboundedSender<Task<()>>,
    ) {
        // Self isn't guaranteed to live into the exception handling of the async block. We need to clone self
        // to have a version that can be referenced in the exception handling.
        let batch_iterator_task_sender = task_sender.clone();
        task_sender
            .unbounded_send(fasync::Task::spawn(async move {
                self.archive_accessor_stats.global_stats.connections_opened.add(1);
                while let Ok(Some(ArchiveAccessorRequest::StreamDiagnostics {
                    result_stream,
                    stream_parameters,
                    control_handle: _,
                })) = stream.try_next().await
                {
                    let (requests, control) = match result_stream.into_stream_and_control_handle() {
                        Ok(r) => r,
                        Err(e) => {
                            warn!(?e, "Couldn't bind results channel to executor.");
                            continue;
                        }
                    };
                    self.archive_accessor_stats.global_stats.stream_diagnostics_requests.add(1);
                    let pipeline = self.pipeline.clone();
                    let accessor_stats = self.archive_accessor_stats.clone();
                    let moniker_rewriter = self.moniker_rewriter.clone();
                    // Store the batch iterator task so that we can ensure that the client finishes
                    // draining items through it when a Controller#Stop call happens. For example,
                    // this allows tests to fetch all isolated logs before finishing.
                    batch_iterator_task_sender
                        .unbounded_send(Task::spawn(async move {
                            if let Err(e) = Self::run_server(
                                pipeline,
                                requests,
                                stream_parameters,
                                moniker_rewriter,
                                accessor_stats,
                            )
                            .await
                            {
                                e.close(control);
                            }
                        }))
                        .ok();
                }
                self.archive_accessor_stats.global_stats.connections_closed.add(1);
            }))
            .ok();
    }
pub fn spawn_server ( self , mut stream : ArchiveAccessorRequestStream , task_sender : UnboundedSender < Task < ( ) > > , ) { // Self isn't guaranteed to live into the exception handling of the async block. We need to clone self // to have a version that can be referenced in the exception handling. let batch_iterator_task_sender = task_sender . clone ( ) ; task_sender . unbounded_send ( fasync :: Task :: spawn ( async move { self . archive_accessor_stats . global_stats . connections_opened . add ( 1 ) ; while let Ok ( Some ( ArchiveAccessorRequest :: StreamDiagnostics { result_stream , stream_parameters , control_handle : _ , } ) ) = stream . try_next ( ) . await { let ( requests , control ) = match result_stream . into_stream_and_control_handle ( ) { Ok ( r ) => r , Err ( e ) => { warn ! ( e " " ) ; continue ; } } ; self . archive_accessor_stats . global_stats . stream_diagnostics_requests . add ( 1 ) ; let pipeline = self . pipeline . clone ( ) ; let accessor_stats = self . archive_accessor_stats . clone ( ) ; let moniker_rewriter = self . moniker_rewriter . clone ( ) ; // Store the batch iterator task so that we can ensure that the client finishes // draining items through it when a Controller#Stop call happens. For example, // this allows tests to fetch all isolated logs before finishing. batch_iterator_task_sender . unbounded_send ( Task :: spawn ( async move { if let Err ( e ) = Self :: run_server ( pipeline , requests , stream_parameters , moniker_rewriter , accessor_stats , ) . await { e . close ( control ) ; } } ) ) . ok ( ) ; } self . archive_accessor_stats . global_stats . connections_closed . add ( 1 ) ; } ) ) . ok ( ) ; }
Spawn an instance `fidl_fuchsia_diagnostics/Archive` that allows clients to open
reader session to diagnostics data.
Spawn an instance ` fidl_fuchsia_diagnostics / Archive ` that allows clients to open reader session to diagnostics data .
self
stream
ArchiveAccessorRequestStream
task_sender
UnboundedSender<Task<()>>