pub fn write(&mut self, pid: &Pid, src: &InputSource, event: &NodeEvent) {
        let file_id = FileId(*pid, *src);
        let mut writers = self.writers.lock().expect("couldn't lock");
        writers.entry(file_id).or_insert_with(|| {
            let w = std::io::BufWriter::new(Box::new(
                std::fs::OpenOptions::new()
                    .create(true)
                    .append(true)
                    .open(self.build_filename(&file_id))
                    .expect("couldn't open replica_tee file"),
            ));
            w
        });
        let writer = writers.get_mut(&file_id).expect("log writer lookup failed");
        let json = serde_json::to_string(event).expect("failed to serialize event to json");
        writeln!(writer, "{}", json).expect("couldn't write to replica_tee");
    }
/// Writes an event emitted by a replica to a file whose name is derived
/// from the currently executed pot, pid of the replica and a channel.
Writes an event emitted by a replica to a file whose name is derived
from the currently executed pot, pid of the replica and a channel.
Writes an event emitted by a replica to a file whose name is derived from the currently executed pot pid of the replica and a channel .
pub fn write(&mut self, pid: &Pid, src: &InputSource, event: &NodeEvent) {
        let file_id = FileId(*pid, *src);
        let mut writers = self.writers.lock().expect("couldn't lock");
        writers.entry(file_id).or_insert_with(|| {
            let w = std::io::BufWriter::new(Box::new(
                std::fs::OpenOptions::new()
                    .create(true)
                    .append(true)
                    .open(self.build_filename(&file_id))
                    .expect("couldn't open replica_tee file"),
            ));
            w
        });
        let writer = writers.get_mut(&file_id).expect("log writer lookup failed");
        let json = serde_json::to_string(event).expect("failed to serialize event to json");
        writeln!(writer, "{}", json).expect("couldn't write to replica_tee");
    }
pub fn write ( & mut self , pid : & Pid , src : & InputSource , event : & NodeEvent ) { let file_id = FileId ( * pid , * src ) ; let mut writers = self . writers . lock ( ) . expect ( " " ) ; writers . entry ( file_id ) . or_insert_with ( | | { let w = std :: io :: BufWriter :: new ( Box :: new ( std :: fs :: OpenOptions :: new ( ) . create ( true ) . append ( true ) . open ( self . build_filename ( & file_id ) ) . expect ( " " ) , ) ) ; w } ) ; let writer = writers . get_mut ( & file_id ) . expect ( " " ) ; let json = serde_json :: to_string ( event ) . expect ( " " ) ; writeln ! ( writer " " json ) . expect ( " " ) ; }
Writes an event emitted by a replica to a file whose name is derived
from the currently executed pot, pid of the replica and a channel.
Writes an event emitted by a replica to a file whose name is derived from the currently executed pot pid of the replica and a channel .
&mut self
pid
&Pid
src
&InputSource
event
&NodeEvent
&mut self
pid
&Pid
src
&InputSource
event
&NodeEvent