Clean up a few comments
Change-Id: Ida84f75e97147786c096b2abef72c184585b5149
diff --git a/aos/events/logging/log_namer.h b/aos/events/logging/log_namer.h
index 631016b..cec7ad8 100644
--- a/aos/events/logging/log_namer.h
+++ b/aos/events/logging/log_namer.h
@@ -33,17 +33,26 @@
aos::SizePrefixedFlatbufferDetachedBuffer<LogFileHeader> *header,
const Node *node) = 0;
- // Returns a writer for writing data logged on this channel (on the node
- // provided in the constructor).
+ // Returns a writer for writing data from messages on this channel (on the
+ // primary node).
+ //
+ // The returned pointer will stay valid across rotations, but the object it
+ // points to will be assigned to.
virtual DetachedBufferWriter *MakeWriter(const Channel *channel) = 0;
- // Returns a writer for writing timestamps logged on this channel (on the node
- // provided in the constructor).
+ // Returns a writer for writing timestamps from messages on this channel (on
+ // the primary node).
+ //
+ // The returned pointer will stay valid across rotations, but the object it
+ // points to will be assigned to.
virtual DetachedBufferWriter *MakeTimestampWriter(const Channel *channel) = 0;
// Returns a writer for writing timestamps delivered over the special
// /aos/remote_timestamps/* channels. node is the node that the timestamps
- // are forwarded back from.
+ // are forwarded back from (to the primary node).
+ //
+ // The returned pointer will stay valid across rotations, but the object it
+ // points to will be assigned to.
virtual DetachedBufferWriter *MakeForwardedTimestampWriter(
const Channel *channel, const Node *node) = 0;
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index 7f53577..0403423 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -45,9 +45,11 @@
*this = std::move(other);
}
+// When other is destroyed "soon" (which it should be because we're getting an
+// rvalue reference to it), it will flush etc all the data we have queued up
+// (because that data will then be its data).
DetachedBufferWriter &DetachedBufferWriter::operator=(
DetachedBufferWriter &&other) {
- Flush();
std::swap(filename_, other.filename_);
std::swap(fd_, other.fd_);
std::swap(queued_size_, other.queued_size_);
@@ -378,7 +380,7 @@
if (monotonic_start_time() == monotonic_clock::min_time) {
CHECK_EQ(realtime_start_time(), realtime_clock::min_time);
// We should only be missing the monotonic start time when logging data
- // for remote nodes. We don't have a good way to deteremine the remote
+ // for remote nodes. We don't have a good way to determine the remote
// realtime offset, so it shouldn't be filled out.
// TODO(austin): If we have a good way, feel free to fill it out. It
// probably won't be better than we could do in post though with the same
diff --git a/aos/events/logging/logger.cc b/aos/events/logging/logger.cc
index caccf03..424153a 100644
--- a/aos/events/logging/logger.cc
+++ b/aos/events/logging/logger.cc
@@ -296,7 +296,7 @@
const Node *node, int node_index,
aos::monotonic_clock::time_point monotonic_start_time,
aos::realtime_clock::time_point realtime_start_time) {
- // Bail early if there the start times are already set.
+ // Bail early if the start times are already set.
if (node_state_[node_index].monotonic_start_time !=
monotonic_clock::min_time) {
return false;
@@ -1194,8 +1194,7 @@
CHECK(channel_data.message().data() != nullptr)
<< ": Got a message without data. Forwarding entry which was "
"not matched? Use --skip_missing_forwarding_entries to "
- "ignore "
- "this.";
+ "ignore this.";
if (update_time) {
// Confirm that the message was sent on the sending node before the
diff --git a/aos/events/logging/logger.h b/aos/events/logging/logger.h
index 32c2022..a3189db 100644
--- a/aos/events/logging/logger.h
+++ b/aos/events/logging/logger.h
@@ -524,7 +524,7 @@
// constrain our time function.
//
// One is simple. The distributed clock is the average of all the clocks.
- // (ta + tb + tc + td) / num_nodex = t_distributed
+ // (ta + tb + tc + td) / num_nodes = t_distributed
//
// The second is a bit more complicated. Our basic time conversion function
// is:
@@ -540,7 +540,7 @@
// per-node times at two set distributed clock times, we will be able to
// recreate the linear function (we know it is linear). We can do a similar
// thing by breaking our equation up into:
- //
+ //
// [1/3 1/3 1/3 ] [ta] [t_distributed]
// [ 1 -1-m1 0 ] [tb] = [oab]
// [ 1 0 -1-m2 ] [tc] [oac]