-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RoutingGroups: generate explicit
false
specializations; remove default
Summary: Two problems with the current "default false" approach: 1) If the specialization file is not included in a translation unit, the request will incorrectly default to false. In this new approach this will be a compile error - the correct routing groups file must be included. 2) Default false means some bugs snuck in (using GetLike with something that's not a request type, e.g. a reply or void by mistake) - see stacked diffs for fixes. Changes in this diff: 1) New special routing group "no_group" to list requests for which all *Like traits should be false. The invariant is that every request must belong to one and only one group. 2) Removes default false, and introduces explicit true/false specializations for all requests. Reviewed By: disylh, stuclar, antonf Differential Revision: D62321258 fbshipit-source-id: b27f1fe3c61513b31578ba48cf16ed8a2df28138
- Loading branch information
1 parent
914a238
commit 2bf49f0
Showing
21 changed files
with
765 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
mcrouter/lib/carbon/example/gen/HelloGoodbyeRoutingGroups.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
* @generated | ||
*/ | ||
#pragma once | ||
|
||
#include <mcrouter/lib/carbon/RoutingGroups.h> | ||
|
||
#include "mcrouter/lib/carbon/example/gen/HelloGoodbyeMessages.h" | ||
|
||
namespace carbon { | ||
|
||
// ArithmeticLike | ||
template <> | ||
struct ArithmeticLike<hellogoodbye::GoodbyeRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct ArithmeticLike<hellogoodbye::HelloRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// DeleteLike | ||
template <> | ||
struct DeleteLike<hellogoodbye::GoodbyeRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct DeleteLike<hellogoodbye::HelloRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// GetLike | ||
template <> | ||
struct GetLike<hellogoodbye::GoodbyeRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct GetLike<hellogoodbye::HelloRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// UpdateLike | ||
template <> | ||
struct UpdateLike<hellogoodbye::GoodbyeRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct UpdateLike<hellogoodbye::HelloRequest> { | ||
static const bool value = false; | ||
}; | ||
} // namespace carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,10 @@ reply TestAReply { | |
|
||
service { | ||
enable_shutdown: true; | ||
|
||
routing_groups: { | ||
no_group: [ | ||
TestARequest, | ||
] | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,10 @@ reply TestBReply { | |
|
||
service { | ||
enable_shutdown: true; | ||
|
||
routing_groups: { | ||
no_group: [ | ||
TestBRequest, | ||
] | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
* @generated | ||
*/ | ||
#pragma once | ||
|
||
#include <mcrouter/lib/carbon/RoutingGroups.h> | ||
|
||
#include "mcrouter/lib/carbon/test/gen/AMessages.h" | ||
|
||
namespace carbon { | ||
|
||
// ArithmeticLike | ||
template <> | ||
struct ArithmeticLike<carbon::test::A::TestARequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// DeleteLike | ||
template <> | ||
struct DeleteLike<carbon::test::A::TestARequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// GetLike | ||
template <> | ||
struct GetLike<carbon::test::A::TestARequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// UpdateLike | ||
template <> | ||
struct UpdateLike<carbon::test::A::TestARequest> { | ||
static const bool value = false; | ||
}; | ||
} // namespace carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
* @generated | ||
*/ | ||
#pragma once | ||
|
||
#include <mcrouter/lib/carbon/RoutingGroups.h> | ||
|
||
#include "mcrouter/lib/carbon/test/gen/BMessages.h" | ||
|
||
namespace carbon { | ||
|
||
// ArithmeticLike | ||
template <> | ||
struct ArithmeticLike<carbon::test::B::TestBRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// DeleteLike | ||
template <> | ||
struct DeleteLike<carbon::test::B::TestBRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// GetLike | ||
template <> | ||
struct GetLike<carbon::test::B::TestBRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
// UpdateLike | ||
template <> | ||
struct UpdateLike<carbon::test::B::TestBRequest> { | ||
static const bool value = false; | ||
}; | ||
} // namespace carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
/* | ||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN | ||
* VAIN. | ||
* | ||
* @generated | ||
*/ | ||
#pragma once | ||
|
||
#include <mcrouter/lib/carbon/RoutingGroups.h> | ||
|
||
#include "mcrouter/lib/carbon/test/gen/CarbonTestMessages.h" | ||
|
||
namespace carbon { | ||
|
||
// ArithmeticLike | ||
template <> | ||
struct ArithmeticLike<carbon::test::TestRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct ArithmeticLike<carbon::test::TestRequestStringKey> { | ||
static const bool value = false; | ||
}; | ||
|
||
// DeleteLike | ||
template <> | ||
struct DeleteLike<carbon::test::TestRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct DeleteLike<carbon::test::TestRequestStringKey> { | ||
static const bool value = false; | ||
}; | ||
|
||
// GetLike | ||
template <> | ||
struct GetLike<carbon::test::TestRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct GetLike<carbon::test::TestRequestStringKey> { | ||
static const bool value = false; | ||
}; | ||
|
||
// UpdateLike | ||
template <> | ||
struct UpdateLike<carbon::test::TestRequest> { | ||
static const bool value = false; | ||
}; | ||
|
||
template <> | ||
struct UpdateLike<carbon::test::TestRequestStringKey> { | ||
static const bool value = false; | ||
}; | ||
} // namespace carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.