ccv: rename error type enumerators
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 3 May 2024 15:18:51 +0000 (11:18 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Oct 2024 02:56:57 +0000 (22:56 -0400)
In the names of enumerators:

 - Replace "other" with "unknown" when referring to origins in clock
   correlation validator error types.

   The origin of a clock class is either known or unknown.  As of MIP 0,
   the only way for a clock class origin to be known is for it to be the
   Unix epoch, so it's really either Unix epoch or unknown.

   With MIP 1, it will become possible to have known origins that are
   not the Unix epoch.  Using the term "unknown" here makes it clear
   that we are not talking about that.

 - Replace "origin uuid" with "origin unknown with uuid", "origin no
   uuid" with "origin unknown without uuid".  The formers make it sound
   like the origins have UUIDs, which is not the case.  The clock class
   (which is implied in the name) has a UUID.

 - Make the enumerators extra explicit to avoid any ambiguity.

Change-Id: I4e9f9e6caf4e09de2ff1a2d26fe10a1a5f343453
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12783
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/clock-correlation-validator/clock-correlation-validator.cpp
src/clock-correlation-validator/clock-correlation-validator.h
src/clock-correlation-validator/clock-correlation-validator.hpp
src/lib/graph/iterator.c
src/plugins/utils/muxer/msg-iter.cpp

index a0f015a5d51d21f58fe08c6c61709778f1a6d696..88e9c89f53a47fef5ce032e1d3f9b42b053032c3 100644 (file)
@@ -45,9 +45,9 @@ void ClockCorrelationValidator::_validate(const bt2::ConstMessage msg)
             if (clockCls->origin().isUnixEpoch()) {
                 _mExpectation = PropsExpectation::OriginUnix;
             } else if (const auto uuid = clockCls->uuid()) {
-                _mExpectation = PropsExpectation::OriginOtherUuid;
+                _mExpectation = PropsExpectation::OriginUnknownWithUuid;
             } else {
-                _mExpectation = PropsExpectation::OriginOtherNoUuid;
+                _mExpectation = PropsExpectation::OriginUnknownWithoutUuid;
             }
         } else {
             _mExpectation = PropsExpectation::None;
@@ -66,60 +66,67 @@ void ClockCorrelationValidator::_validate(const bt2::ConstMessage msg)
 
     case PropsExpectation::OriginUnix:
         if (!clockCls) {
-            throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUnixGotNone,
-                                         {},
-                                         *_mRefClockClass,
-                                         streamCls};
+            throw ClockCorrelationError {
+                ClockCorrelationError::Type::ExpectingOriginUnixGotNoClockClass,
+                {},
+                *_mRefClockClass,
+                streamCls};
         }
 
         if (!clockCls->origin().isUnixEpoch()) {
-            throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUnixGotOther,
-                                         *clockCls, *_mRefClockClass, streamCls};
+            throw ClockCorrelationError {
+                ClockCorrelationError::Type::ExpectingOriginUnixGotUnknownOrigin, *clockCls,
+                *_mRefClockClass, streamCls};
         }
 
         break;
 
-    case PropsExpectation::OriginOtherUuid:
+    case PropsExpectation::OriginUnknownWithUuid:
     {
         if (!clockCls) {
-            throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUuidGotNone,
-                                         {},
-                                         *_mRefClockClass,
-                                         streamCls};
+            throw ClockCorrelationError {
+                ClockCorrelationError::Type::ExpectingOriginUnknownWithUuidGotNoClockClass,
+                {},
+                *_mRefClockClass,
+                streamCls};
         }
 
         if (clockCls->origin().isUnixEpoch()) {
-            throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUuidGotUnix,
-                                         *clockCls, *_mRefClockClass, streamCls};
+            throw ClockCorrelationError {
+                ClockCorrelationError::Type::ExpectingOriginUnknownWithUuidGotUnixOrigin, *clockCls,
+                *_mRefClockClass, streamCls};
         }
 
         const auto uuid = clockCls->uuid();
 
         if (!uuid) {
-            throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginUuidGotNoUuid,
-                                         *clockCls, *_mRefClockClass, streamCls};
+            throw ClockCorrelationError {
+                ClockCorrelationError::Type::ExpectingOriginUnknownWithUuidGotWithoutUuid,
+                *clockCls, *_mRefClockClass, streamCls};
         }
 
         if (*uuid != *_mRefClockClass->uuid()) {
             throw ClockCorrelationError {
-                ClockCorrelationError::Type::ExpectingOriginUuidGotOtherUuid, *clockCls,
+                ClockCorrelationError::Type::ExpectingOriginUnknownWithUuidGotOtherUuid, *clockCls,
                 *_mRefClockClass, streamCls};
         }
 
         break;
     }
 
-    case PropsExpectation::OriginOtherNoUuid:
+    case PropsExpectation::OriginUnknownWithoutUuid:
         if (!clockCls) {
-            throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginNoUuidGotNone,
-                                         {},
-                                         *_mRefClockClass,
-                                         streamCls};
+            throw ClockCorrelationError {
+                ClockCorrelationError::Type::ExpectingOriginUnknownWithoutUuidGotNoClockClass,
+                {},
+                *_mRefClockClass,
+                streamCls};
         }
 
         if (clockCls->libObjPtr() != _mRefClockClass->libObjPtr()) {
-            throw ClockCorrelationError {ClockCorrelationError::Type::ExpectingOriginNoUuidGotOther,
-                                         *clockCls, *_mRefClockClass, streamCls};
+            throw ClockCorrelationError {
+                ClockCorrelationError::Type::ExpectingOriginUnknownWithoutUuidGotOtherClockClass,
+                *clockCls, *_mRefClockClass, streamCls};
         }
 
         break;
index bed3dbad7fdbe94205b8fee62ecf45ee9aff356a..25d9b420a947329107206177f5c9962da8bca94a 100644 (file)
@@ -23,14 +23,17 @@ struct bt_message;
 enum bt_clock_correlation_validator_error_type
 {
        BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_NO_CLOCK_CLASS_GOT_ONE,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NONE,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_OTHER,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NONE,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_UNIX,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NO_UUID,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_NONE,
-       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_OTHER,
+
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NO_CLOCK_CLASS,
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_UNKNOWN_ORIGIN,
+
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_NO_CLOCK_CLASS,
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_UNIX_ORIGIN,
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_WITHOUT_UUID,
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_OTHER_UUID,
+
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITHOUT_UUID_GOT_NO_CLOCK_CLASS,
+       BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITHOUT_UUID_GOT_OTHER_CLOCK_CLASS,
 };
 
 struct bt_clock_correlation_validator *bt_clock_correlation_validator_create(
index 0e0664289a3f3ebc8c344ab71acfc0fcaa5535cf..4326bdb38aeee39b28ef386f0f729338c94c7504 100644 (file)
@@ -20,22 +20,25 @@ public:
     {
         ExpectingNoClockClassGotOne =
             BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_NO_CLOCK_CLASS_GOT_ONE,
-        ExpectingOriginUnixGotNone =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NONE,
-        ExpectingOriginUnixGotOther =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_OTHER,
-        ExpectingOriginUuidGotNone =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NONE,
-        ExpectingOriginUuidGotUnix =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_UNIX,
-        ExpectingOriginUuidGotNoUuid =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NO_UUID,
-        ExpectingOriginUuidGotOtherUuid =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID,
-        ExpectingOriginNoUuidGotNone =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_NONE,
-        ExpectingOriginNoUuidGotOther =
-            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_OTHER,
+
+        ExpectingOriginUnixGotNoClockClass =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NO_CLOCK_CLASS,
+        ExpectingOriginUnixGotUnknownOrigin =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_UNKNOWN_ORIGIN,
+
+        ExpectingOriginUnknownWithUuidGotNoClockClass =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_NO_CLOCK_CLASS,
+        ExpectingOriginUnknownWithUuidGotUnixOrigin =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_UNIX_ORIGIN,
+        ExpectingOriginUnknownWithUuidGotWithoutUuid =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_WITHOUT_UUID,
+        ExpectingOriginUnknownWithUuidGotOtherUuid =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_OTHER_UUID,
+
+        ExpectingOriginUnknownWithoutUuidGotNoClockClass =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITHOUT_UUID_GOT_NO_CLOCK_CLASS,
+        ExpectingOriginUnknownWithoutUuidGotOtherClockClass =
+            BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITHOUT_UUID_GOT_OTHER_CLOCK_CLASS,
     };
 
     explicit ClockCorrelationError(
@@ -90,11 +93,11 @@ private:
         /* Expect a clock with a Unix epoch origin. */
         OriginUnix,
 
-        /* Expect a clock without a Unix epoch origin, but with a UUID. */
-        OriginOtherUuid,
+        /* Expect a clock with an unknown origin, but with a UUID. */
+        OriginUnknownWithUuid,
 
-        /* Expect a clock without a Unix epoch origin and without a UUID. */
-        OriginOtherNoUuid,
+        /* Expect a clock with an unknown origin and without a UUID. */
+        OriginUnknownWithoutUuid,
     };
 
 public:
index d27f328423d90c03551e62d9eac0ee0401c88b01..d7119ee0d409c070f3b2966d64d8e5100ed0be6d 100644 (file)
@@ -697,41 +697,41 @@ void assert_post_dev_clock_classes_are_compatible_one(
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "stream-class-has-no-clock-class", false,
                                "Expecting no clock class, got one.");
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NONE:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_NO_CLOCK_CLASS:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "stream-class-has-clock-class-with-unix-epoch-origin", false,
                                "Expecting a clock class, got none.");
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_OTHER:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNIX_GOT_UNKNOWN_ORIGIN:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "clock-class-has-unix-epoch-origin", false,
                                "Expecting a clock class with Unix epoch origin: %![cc-]+K",
                                actual_clock_cls);
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NONE:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_NO_CLOCK_CLASS:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "stream-class-has-clock-class-with-uuid", false,
                                "Expecting a clock class, got none.");
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_UNIX:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_UNIX_ORIGIN:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "clock-class-has-non-unix-epoch-origin", false,
                                "Expecting a clock class without Unix epoch origin: %![cc-]+K",
                                actual_clock_cls);
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_NO_UUID:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_WITHOUT_UUID:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "clock-class-has-uuid", false,
                                "Expecting a clock class with UUID:  %![cc-]+K",
                                actual_clock_cls);
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UUID_GOT_OTHER_UUID:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITH_UUID_GOT_OTHER_UUID:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "clock-class-has-expected-uuid", false,
                                "Expecting a clock class with UUID, got one with a different UUID: "
                                "%![cc-]+K, expected-uuid=%!u",
                                actual_clock_cls, bt_clock_class_get_uuid(ref_clock_cls));
 
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_NONE:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITHOUT_UUID_GOT_NO_CLOCK_CLASS:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "stream-class-has-clock-class", false,
                                "Expecting a clock class, got none.");
-               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_NO_UUID_GOT_OTHER:
+               case BT_CLOCK_CORRELATION_VALIDATOR_ERROR_TYPE_EXPECTING_ORIGIN_UNKNOWN_WITHOUT_UUID_GOT_OTHER_CLOCK_CLASS:
                        BT_ASSERT_POST_DEV(NEXT_METHOD_NAME,
                                "clock-class-is-expected", false,
                                "Unexpected clock class: %![expected-cc-]+K, %![actual-cc-]+K",
index 2da2b8d0369dcf4c7fb79f5d133d8c4feb8ebfde..cc7198987f1f735829b6a271ee97e8a219711b75 100644 (file)
@@ -260,9 +260,9 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg)
                 "Expecting no clock class, but got one: clock-class-addr={}, clock-class-name={}",
                 fmt::ptr(actualClkCls->libObjPtr()), actualClkCls->name());
 
-        case Type::ExpectingOriginUnixGotNone:
-        case Type::ExpectingOriginUuidGotNone:
-        case Type::ExpectingOriginNoUuidGotNone:
+        case Type::ExpectingOriginUnixGotNoClockClass:
+        case Type::ExpectingOriginUnknownWithUuidGotNoClockClass:
+        case Type::ExpectingOriginUnknownWithoutUuidGotNoClockClass:
             BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
                 bt2::Error,
                 "Expecting a clock class, but got none: stream-class-addr={}, "
@@ -270,14 +270,14 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg)
                 fmt::ptr(error.streamCls()->libObjPtr()), error.streamCls()->name(),
                 error.streamCls()->id());
 
-        case Type::ExpectingOriginUnixGotOther:
+        case Type::ExpectingOriginUnixGotUnknownOrigin:
             BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
                 bt2::Error,
                 "Expecting a clock class having a Unix epoch origin, but got one not having a Unix "
                 "epoch origin: clock-class-addr={}, clock-class-name={}",
                 fmt::ptr(actualClkCls->libObjPtr()), actualClkCls->name());
 
-        case Type::ExpectingOriginUuidGotUnix:
+        case Type::ExpectingOriginUnknownWithUuidGotUnixOrigin:
             BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
                 bt2::Error,
                 "Expecting a clock class not having a Unix epoch origin, "
@@ -285,14 +285,14 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg)
                 "clock-class-addr={}, clock-class-name={}",
                 fmt::ptr(actualClkCls->libObjPtr()), actualClkCls->name());
 
-        case Type::ExpectingOriginUuidGotNoUuid:
+        case Type::ExpectingOriginUnknownWithUuidGotWithoutUuid:
             BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
                 bt2::Error,
                 "Expecting a clock class with a UUID, but got one without a UUID: "
                 "clock-class-addr={}, clock-class-name={}",
                 fmt::ptr(actualClkCls->libObjPtr()), actualClkCls->name());
 
-        case Type::ExpectingOriginUuidGotOtherUuid:
+        case Type::ExpectingOriginUnknownWithUuidGotOtherUuid:
             BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
                 bt2::Error,
                 "Expecting a clock class with a specific UUID, but got one with a different UUID: "
@@ -300,7 +300,7 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg)
                 fmt::ptr(actualClkCls->libObjPtr()), actualClkCls->name(), *refClkCls->uuid(),
                 *actualClkCls->uuid());
 
-        case Type::ExpectingOriginNoUuidGotOther:
+        case Type::ExpectingOriginUnknownWithoutUuidGotOtherClockClass:
             BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
                 bt2::Error,
                 "Unexpected clock class: "
This page took 0.029814 seconds and 4 git commands to generate.