Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pb/A2o.proto
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ enum OutputStreamType {

message RunlogOutputFragment {
uint64 runlog_id = 1;
uint64 output_at_ts = 2;
uint64 output_at_ts = 2 [deprecated = true];
OutputStreamType stream_type = 3;
bytes output_fragment = 4;
uint64 output_at_nano_ts = 5;
}

message A2oMessage {
Expand Down
3 changes: 3 additions & 0 deletions src/generated/pb/a2o.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@ pub struct RunlogFinished {
pub struct RunlogOutputFragment {
#[prost(uint64, tag = "1")]
pub runlog_id: u64,
#[deprecated]
#[prost(uint64, tag = "2")]
pub output_at_ts: u64,
#[prost(enumeration = "OutputStreamType", tag = "3")]
pub stream_type: i32,
#[prost(bytes = "vec", tag = "4")]
pub output_fragment: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag = "5")]
pub output_at_nano_ts: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct A2oMessage {
Expand Down
3 changes: 2 additions & 1 deletion src/o2a_messages/runlog_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::generated::pb::a2o::{
};
use crate::generated::pb::o2a::RunlogRun;
use crate::message_queue::MessageQueue;
use crate::utils::current_timestamp_secs;
use crate::utils::{current_timestamp_nanos, current_timestamp_secs};
use std::fs;
use std::path::PathBuf;
use std::process::Stdio;
Expand Down Expand Up @@ -115,6 +115,7 @@ where
MessageQueue::push(A2oPayload::RunlogOutputFragment(RunlogOutputFragment {
runlog_id,
output_at_ts: current_timestamp_secs()?,
output_at_nano_ts: current_timestamp_nanos()?,
stream_type: stream_type as i32,
output_fragment: buffer[..n].to_vec(),
}))
Expand Down
4 changes: 4 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ pub fn current_timestamp() -> anyhow::Result<Duration> {
pub fn current_timestamp_secs() -> anyhow::Result<u64> {
current_timestamp().map(|d| d.as_secs())
}

pub fn current_timestamp_nanos() -> anyhow::Result<u64> {
current_timestamp().map(|d| d.as_nanos() as u64)
}
Loading