-
Notifications
You must be signed in to change notification settings - Fork 833
Add nexthop strategy plugins #7023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b46f8a9
0f1b33a
8441e6b
a247d1b
830be98
387f2d2
ece3d57
6cf3985
ba46135
bcc3f7f
a9e2a14
357544f
b78a74a
a89b8b7
9412a14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** @file | ||
|
||
@section license License | ||
|
||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ts/apidefs.h" | ||
#include "tscore/ConsistentHash.h" | ||
#include <netinet/in.h> | ||
|
||
extern const char *ParentResultStr[]; | ||
|
||
struct TSParentResult { | ||
const char *hostname; | ||
in_port_t port; | ||
bool retry; | ||
TSParentResultType result; | ||
bool chash_init[TS_MAX_GROUP_RINGS] = {false}; | ||
TSHostStatus first_choice_status = TSHostStatus::TS_HOST_STATUS_INIT; | ||
int line_number; | ||
uint32_t last_parent; | ||
uint32_t start_parent; | ||
uint32_t last_group; | ||
bool wrap_around; | ||
bool mapWrapped[2]; | ||
int last_lookup; | ||
ATSConsistentHashIter chashIter[TS_MAX_GROUP_RINGS]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the hash values and iterators needed in this result structure? Is this intended as a state object and not just a result? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it's a state object. Used by both ParentSelection and Strategies in core (or rather, copied to an identical structure in core). I.e. |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
pkglib_LTLIBRARIES += experimental/nexthop_strategy_consistenthash/nexthop_strategy_consistenthash.la | ||
|
||
experimental_nexthop_strategy_consistenthash_nexthop_strategy_consistenthash_la_SOURCES = \ | ||
experimental/nexthop_strategy_consistenthash/strategy.cc \ | ||
experimental/nexthop_strategy_consistenthash/healthstatus.cc \ | ||
experimental/nexthop_strategy_consistenthash/consistenthash.cc \ | ||
experimental/nexthop_strategy_consistenthash/consistenthash_config.cc \ | ||
experimental/nexthop_strategy_consistenthash/plugin_consistenthash.cc | ||
|
||
experimental_nexthop_strategy_consistenthash_nexthop_strategy_consistenthash_la_LDFLAGS = \ | ||
$(AM_LDFLAGS) | ||
|
||
AM_CPPFLAGS += @YAMLCPP_INCLUDES@ $(TS_INCLUDES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really useful? Why not have
findNextHop
returnbool
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findNextHop
modifies the state to be the next parent;nextHopExists
returns without modifying state.I'd be a big +1 on making
findNextHop
return and be a pure function. But that'd require refactoring how Strategies work and are called in core. Which I'm guessing itself is a reflection of how ParentSelection always did it.