+1 add the new API's John Rushford jrushf...@apache.org
On Tue, Mar 9, 2021 at 10:08 AM Robert O Butts <r...@apache.org> wrote: > > > ---------- Forwarded message --------- > From: Robert O Butts <r...@apache.org> > Date: Fri, Feb 26, 2021 at 8:46 AM > Subject: [VOTE] New API symbols for Parent Selection > To: <dev@trafficserver.apache.org> > > > I'd like to propose adding the following symbols to the API, to make it > possible for remap plugins to do next-hop parent selection: > > enum TSHostStatus > enum TSHostStatusReason > TSReturnCode TSHostnameIsSelf(const char *hostname); > TSReturnCode TSHostStatusGet(const char *hostname, const size_t > hostname_len, TSHostStatus *status, unsigned int *reason); > void TSHostStatusSet(const char *hostname, const size_t hostname_len, > TSHostStatus status, const unsigned int down_time, const unsigned int > reason); > struct TSResponseAction; > void TSHttpTxnResponseActionSet(TSHttpTxn txnp, TSResponseAction action); > void TSHttpTxnResponseActionGet(TSHttpTxn txnp, TSResponseAction *action); > > I have a PR to do this, as well as a plugin for ConsistentHash parent > selection: > > https://github.com/apache/trafficserver/pull/7467 > > All new symbols except the ResponseAction ones expose existing things in > core which are necessary for parent selection. > > The ResponseAction struct is a small C struct with the data necessary to > do parent selection, essentially everything that's a function in Strategies > today. > > In a nutshell, everything in core (HttpTransact.cc) that was `if > (strategy) { } else { /* old parent */ }` becomes `if > (response_action.handled) { } else if (strategy) { } else { /* old parent > */ }`. > > This supersedes my previous proposal. The previous proposal was a small > core change, but had the downside of not being a real Remap plugin, and not > having access to Continuations, Hooks, etc. The alternative seemed to be > large core State Machine changes. > > I believe this is the best of both worlds: a small core change, while > still being a real plugin with access to continuations and hooks. > > The advantage is immediately evident: in the plugin, all the > per-transaction hash data is moved into the plugin and stored in the > continuation, out of core (ParentResult). Which means less logic in core, > and ParentResult can be deleted if parent.config and core strategies are > removed. This was impossible with the previous method of dropping the > strategy object into core. > > Feedback welcome, please vote, thanks! > >