rob05c commented on a change in pull request #7023:
URL: https://github.com/apache/trafficserver/pull/7023#discussion_r507996700
##########
File path: include/tscpp/api/nexthop.h
##########
@@ -30,20 +30,20 @@
#include <ts/apidefs.h>
-// plugin callback commands.
enum NHCmd { NH_MARK_UP, NH_MARK_DOWN };
-struct NHHealthStatus {
- virtual bool isNextHopAvailable(TSHttpTxn txn, const char *hostname, const
int port, void *ih = nullptr) = 0;
- virtual void markNextHop(TSHttpTxn txn, const char *hostname, const int
port, const NHCmd status, void *ih = nullptr,
- const time_t now = 0)
= 0;
- virtual ~NHHealthStatus() {}
-};
+class TSNextHopSelectionStrategy
+{
+public:
+ TSNextHopSelectionStrategy(){};
+ virtual ~TSNextHopSelectionStrategy(){};
-struct NHPluginStrategy {
- virtual void findNextHop(TSHttpTxn txnp, void *ih = nullptr) = 0;
- virtual bool nextHopExists(TSHttpTxn txnp, void *ih = nullptr) = 0;
- virtual ~NHPluginStrategy() {}
+ virtual void findNextHop(TSHttpTxn txnp, time_t now = 0)
= 0;
+ virtual void markNextHop(TSHttpTxn txnp, const char *hostname, const int
port, const NHCmd status, const time_t now = 0) = 0;
+ virtual bool nextHopExists(TSHttpTxn txnp)
= 0;
Review comment:
`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.
----------------------------------------------------------------
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]