[trafficserver] branch 9.0.x updated: Refactor and generalize the User Arg concept, add global (#6468)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new 85ccc06 Refactor and generalize the User Arg concept, add global (#6468) 85ccc06 is described below commit 85ccc06f093b7b1c5c40fc50d515b2f37e52ca60 Author: Leif Hedstrom AuthorDate: Fri Mar 13 14:12:23 2020 -0600 Refactor and generalize the User Arg concept, add global (#6468) * First refactoring, eliminates many of the lookup APIs * Refactor all User Args, deprecating all old APIs for Get() / Set(). * Adds the global / GLB type of user args * Adds a plugin for testing the APIs, can maybe be used by autest * Makes the proper enum name prefixes for the new constants * Changes the max defines to an array * Updated Docs with these changes (cherry picked from commit 678b605a0dd3daa7c43a87b653aedff7eab6f3bf) --- .../api/functions/TSHttpArgs.en.rst| 11 +- doc/developer-guide/api/functions/TSTypes.en.rst | 4 + .../api/functions/TSUserArgs.en.rst| 112 ++ .../api/functions/TSVConnArgs.en.rst | 8 +- .../design-documents/reloading-plugins.en.rst | 16 +- example/plugins/c-api/remap/remap.cc | 6 +- example/plugins/c-api/vconn_args/vconn_args.cc | 8 +- include/ts/apidefs.h.in| 9 + include/ts/ts.h| 49 +++-- include/tscore/PluginUserArgs.h| 74 +++ iocore/eventsystem/I_VConnection.h | 40 +--- iocore/net/I_NetVConnection.h | 4 +- plugins/authproxy/authproxy.cc | 12 +- plugins/esi/combo_handler.cc | 8 +- .../ja3_fingerprint/ja3_fingerprint.cc | 12 +- plugins/experimental/remap_stats/remap_stats.cc| 12 +- plugins/experimental/traffic_dump/traffic_dump.cc | 8 +- plugins/xdebug/Cleanup.h | 8 +- proxy/InkAPIInternal.h | 2 - proxy/ProxySession.cc | 5 +- proxy/ProxySession.h | 21 +- proxy/http/HttpSM.h| 2 +- proxy/http/HttpTransact.h | 3 - src/traffic_server/InkAPI.cc | 114 ++ src/tscpp/api/utils_internal.cc| 6 +- tests/tools/plugins/user_args.cc | 236 + 26 files changed, 605 insertions(+), 185 deletions(-) diff --git a/doc/developer-guide/api/functions/TSHttpArgs.en.rst b/doc/developer-guide/api/functions/TSHttpArgs.en.rst index fec1dd0..a564eb2 100644 --- a/doc/developer-guide/api/functions/TSHttpArgs.en.rst +++ b/doc/developer-guide/api/functions/TSHttpArgs.en.rst @@ -17,12 +17,19 @@ .. include:: ../../../common.defs .. default-domain:: c + TSHttpArgs ** Synopsis +.. note:: + + This set of API is obsoleted as of ATS v9.0.0, and will be removed with ATS v10.0.0! + For details of the new APIs, see :ref:`tsuserargs`. + + .. code-block:: cpp #include @@ -35,8 +42,8 @@ Synopsis .. function:: TSReturnCode TSHttpSsnArgIndexLookup(int arg_idx, const char ** name, const char ** description) .. function:: void TSHttpTxnArgSet(TSHttpTxn txnp, int arg_idx, void * arg) .. function:: void * TSHttpTxnArgGet(TSHttpTxn txnp, int arg_idx) -.. function:: void TSHttpSsnArgSet(TSHttpTxn txnp, int arg_idx, void * arg) -.. function:: void * TSHttpSsnArgGet(TSHttpTxn txnp, int arg_idx) +.. function:: void TSHttpSsnArgSet(TSHttpSsn ssnp, int arg_idx, void * arg) +.. function:: void * TSHttpSsnArgGet(TSHttpSsn ssnp, int arg_idx) Description === diff --git a/doc/developer-guide/api/functions/TSTypes.en.rst b/doc/developer-guide/api/functions/TSTypes.en.rst index e158c97..a63c5fb 100644 --- a/doc/developer-guide/api/functions/TSTypes.en.rst +++ b/doc/developer-guide/api/functions/TSTypes.en.rst @@ -217,6 +217,10 @@ more widely. Those are described on this page. .. type:: TSThreadFunc +.. type:: TSUserArgType + + An enum for the supported types of user arguments. + .. type:: TSUuidVersion A version value for at :type:`TSUuid`. diff --git a/doc/developer-guide/api/functions/TSUserArgs.en.rst b/doc/developer-guide/api/functions/TSUserArgs.en.rst new file mode 100644 index 000..5dc0208 --- /dev/null +++ b/doc/developer-guide/api/functions/TSUserArgs.en.rst @@ -0,0 +1,112 @@ +.. 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
[trafficserver] branch master updated (c64530f -> 678b605)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from c64530f Check the exit value of the regression test add 678b605 Refactor and generalize the User Arg concept, add global (#6468) No new revisions were added by this update. Summary of changes: .../api/functions/TSHttpArgs.en.rst| 11 +- doc/developer-guide/api/functions/TSTypes.en.rst | 4 + .../api/functions/TSUserArgs.en.rst| 112 ++ .../api/functions/TSVConnArgs.en.rst | 8 +- .../design-documents/reloading-plugins.en.rst | 16 +- example/plugins/c-api/remap/remap.cc | 6 +- example/plugins/c-api/vconn_args/vconn_args.cc | 8 +- include/ts/apidefs.h.in| 9 + include/ts/ts.h| 49 +++-- include/tscore/PluginUserArgs.h| 74 +++ iocore/eventsystem/I_VConnection.h | 40 +--- iocore/net/I_NetVConnection.h | 4 +- plugins/authproxy/authproxy.cc | 12 +- plugins/esi/combo_handler.cc | 8 +- .../ja3_fingerprint/ja3_fingerprint.cc | 12 +- plugins/experimental/remap_stats/remap_stats.cc| 12 +- plugins/experimental/traffic_dump/traffic_dump.cc | 8 +- plugins/xdebug/Cleanup.h | 8 +- proxy/InkAPIInternal.h | 2 - proxy/ProxySession.cc | 5 +- proxy/ProxySession.h | 21 +- proxy/http/HttpSM.h| 2 +- proxy/http/HttpTransact.h | 3 - src/traffic_server/InkAPI.cc | 114 ++ src/tscpp/api/utils_internal.cc| 6 +- tests/tools/plugins/user_args.cc | 236 + 26 files changed, 605 insertions(+), 185 deletions(-) create mode 100644 doc/developer-guide/api/functions/TSUserArgs.en.rst create mode 100644 include/tscore/PluginUserArgs.h create mode 100644 tests/tools/plugins/user_args.cc
[trafficserver] branch master updated (3808b31 -> c64530f)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 3808b31 Fix SDK_API_TSSslServerContextCreate add c64530f Check the exit value of the regression test No new revisions were added by this update. Summary of changes: ci/jenkins/bin/github.sh | 5 ++--- ci/jenkins/bin/regression.sh | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-)
[trafficserver] branch master updated (c990f54 -> 3808b31)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from c990f54 Exponential backoff - Make values used configurable - Add config support for ceiling time and retry cap. - Add small variance when sleeping. add 3808b31 Fix SDK_API_TSSslServerContextCreate No new revisions were added by this update. Summary of changes: iocore/net/SSLUtils.cc | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-)
[trafficserver] branch master updated (c05e751 -> c990f54)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from c05e751 Cleanup: check activity of Http2Stream by ActivityCop add c990f54 Exponential backoff - Make values used configurable - Add config support for ceiling time and retry cap. - Add small variance when sleeping. No new revisions were added by this update. Summary of changes: mgmt/RecordsConfig.cc | 5 + src/traffic_manager/traffic_manager.cc | 34 ++ 2 files changed, 31 insertions(+), 8 deletions(-)
[trafficserver] branch master updated: Cleanup: check activity of Http2Stream by ActivityCop
This is an automated email from the ASF dual-hosted git repository. masaori pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new c05e751 Cleanup: check activity of Http2Stream by ActivityCop c05e751 is described below commit c05e7510665258dcac6076a1cba5dcb713bfb2fa Author: Masaori Koshiba AuthorDate: Mon Mar 9 11:01:09 2020 +0900 Cleanup: check activity of Http2Stream by ActivityCop --- iocore/net/NetTimeout.h| 263 + proxy/http2/Http2ConnectionState.h | 10 ++ proxy/http2/Http2Stream.cc | 71 +++--- proxy/http2/Http2Stream.h | 17 +-- 4 files changed, 300 insertions(+), 61 deletions(-) diff --git a/iocore/net/NetTimeout.h b/iocore/net/NetTimeout.h new file mode 100644 index 000..dcc584e --- /dev/null +++ b/iocore/net/NetTimeout.h @@ -0,0 +1,263 @@ +/** @file + + NetTimeout + + @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 "tscore/List.h" +#include "tscore/ink_hrtime.h" + +#include "I_EventSystem.h" + +/** + NetTimeout - handle active & inactive timeout + */ +class NetTimeout +{ +public: + void set_active_timeout(ink_hrtime timeout_in); + void set_inactive_timeout(ink_hrtime timeout_in); + void cancel_active_timeout(); + void cancel_inactive_timeout(); + void reset_active_timeout(); + void reset_inactive_timeout(); + bool is_active_timeout_expired(ink_hrtime now); + bool is_inactive_timeout_expired(ink_hrtime now); + ink_hrtime idle_time(ink_hrtime now); + void update_inactivity(); + +private: + ink_hrtime _active_timeout_in= 0; + ink_hrtime _inactive_timeout_in = 0; + ink_hrtime _next_active_timeout_at = 0; + ink_hrtime _next_inactive_timeout_at = 0; +}; + +/** + ActivityCop - Check activity of T in the List in every @f seconds + + T have to handle VC_EVENT_ACTIVE_TIMEOUT and VC_EVENT_INACTIVITY_TIMEOUT events. + + TODO: add concepts like below with C++20 + ``` + template > + concept Timeoutable = requires(T *t, List *list, ink_hrtime time) { +t->handleEvent(); +t->head; +{list->next(t)} -> std::convertible_to; +{t->is_active_timeout_expired(time)} -> std::same_as; +{t->is_inactive_timeout_expired(time)} -> std::same_as; + }; + ``` + */ +template > class ActivityCop : Continuation +{ +public: + ActivityCop(){}; + ActivityCop(Ptr , List *l, int f); + + void start(); + void stop(); + int check_activity(int event, Event *e); + +private: + Event *_event = nullptr; + List *_list = nullptr; + int _freq = 1; +}; + + +// Inline functions + +// +// NetTimeout +// +inline void +NetTimeout::set_active_timeout(ink_hrtime timeout_in) +{ + if (timeout_in == 0) { +return; + } + + _active_timeout_in = timeout_in; + _next_active_timeout_at = Thread::get_hrtime() + timeout_in; +} + +inline void +NetTimeout::set_inactive_timeout(ink_hrtime timeout_in) +{ + if (timeout_in == 0) { +return; + } + + _inactive_timeout_in = timeout_in; + _next_inactive_timeout_at = Thread::get_hrtime() + timeout_in; +} + +inline void +NetTimeout::cancel_active_timeout() +{ + _active_timeout_in = 0; + _next_active_timeout_at = 0; +} + +inline void +NetTimeout::cancel_inactive_timeout() +{ + _inactive_timeout_in = 0; + _next_inactive_timeout_at = 0; +} + +inline void +NetTimeout::reset_active_timeout() +{ + if (_active_timeout_in == 0) { +return; + } + + _next_active_timeout_at = Thread::get_hrtime() + _active_timeout_in; +} + +inline void +NetTimeout::reset_inactive_timeout() +{ + if (_inactive_timeout_in == 0) { +return; + } + + _next_inactive_timeout_at = Thread::get_hrtime() + _inactive_timeout_in; +} + +inline bool +NetTimeout::is_active_timeout_expired(ink_hrtime now) +{ + ink_assert(now > 0); + + if (_active_timeout_in == 0) { +return false; + } + + if (0 < _next_active_timeout_at && _next_active_timeout_at < now) { +Debug("activity_cop", "active timeout cont=%p now=%" PRId64 " timeout_at=%" PRId64 " timeout_in=%" PRId64, this, + ink_hrtime_to_sec(now),