maskit commented on a change in pull request #6836:
URL: https://github.com/apache/trafficserver/pull/6836#discussion_r433716428
##########
File path: iocore/net/quic/QUICLogFrame.h
##########
@@ -0,0 +1,286 @@
+#pragma once
+
+#include <memory>
+#include <yaml-cpp/yaml.h>
+
+#include "QUICFrame.h"
+
+namespace QLog
+{
+class QLogFrame
+{
+public:
+ QLogFrame(QUICFrameType type) : _type(type) {}
+ virtual ~QLogFrame() {}
+
+ QUICFrameType
+ type() const
+ {
+ return this->_type;
+ }
+
+ // encode frame into YAML stype
+ virtual void encode(YAML::Node &node) = 0;
+
+protected:
+ QUICFrameType _type = QUICFrameType::UNKNOWN;
+};
+
+using QLogFrameUPtr = std::unique_ptr<QLogFrame>;
+
+//
+// convert QUICFrame to QLogFrame
+//
+class QLogFrameFactory
+{
+public:
+ // create QLogFrame
+ static QLogFrameUPtr create(QUICFrame &frame);
+};
+
+namespace Frame
+{
+ struct AckFrame : public QLogFrame {
+ AckFrame(QUICAckFrame &frame) : QLogFrame(frame.type())
Review comment:
There are overlaps but I'd keep those separated. I think current design
is not bad.
QUICFrame and its sub classes are complete representations of each frames,
which have all the details. These (especially Stream frame) are too heavy to
keep long time. This is the reason we have QUICFrameInfo that contains minimal
necessary information.
For QLogFrame, we do need to keep most information, but keeping Stream data
is still too much. Having intermediate representation requires two copies
(QUICFrame -> QLogFrame and QLogFrame -> YAML::Node). I'm not sure how much
creating YAML::Node cost, but maybe we can do something like this:
```
class QLogFrameNode : public YAML::Node {
public:
QLogFrame(const QUICAckFrame &);
QLogFrame(const QUICStreamFrame &);
QLogFrame(const QUICAckFrame &);
};
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]