gtenev commented on a change in pull request #6880:
URL: https://github.com/apache/trafficserver/pull/6880#discussion_r446253465



##########
File path: proxy/http/remap/PluginFactory.cc
##########
@@ -259,6 +272,15 @@ PluginFactory::findByEffectivePath(const fs::path &path, 
bool dynamicReloadEnabl
   return PluginDso::loadedPlugins()->findByEffectivePath(path, 
dynamicReloadEnabled);
 }
 
+bool
+PluginFactory::isGlobalPluginDSOEnabled(const fs::path &path) const

Review comment:
       `isGlobalPluginDSOEnabled` feels nonsensical here, we don't actually 
enable or disable global plugins. This actually shows if the DSO that is used 
as a remap plugin will be reloadable. May be `isPluginDSOReloadEnabled`?

##########
File path: doc/developer-guide/api/functions/TSPluginDSOReloadEnable.en.rst
##########
@@ -0,0 +1,46 @@
+.. 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.
+
+.. include:: ../../../common.defs
+
+.. default-domain:: c
+
+TSPluginDSOReloadEnable
+*************************
+
+Control whether this plugin will take part in the remap dynamic reload 
preocess (remap.config)
+
+Synopsis
+========
+
+.. code-block:: cpp
+
+    #include <ts/ts.h>
+
+.. function:: TSReturnCode TSPluginDSOReloadEnable(int)
+
+Description
+===========
+
+:func:`TSPluginDSOReloadEnable` Set a flag to disable(`false`)/enable(`true`) 
a particular mixed(Global/Remap) plugin to take part in the dynamic reload 
mechanism. This function must be called from inside the :func:`TSPluginInit`.

Review comment:
       I think the term "mixed (Global/Remap plugin" is vague and confusing. 
There are plugins in our source tree that can already run as Global and Remap 
plugins at the same time without the need of disabling the Remap plugin reload 
mechanism, i.e. `header_rewrite` and `cachekey` plugins.
   
   This API call actually provides the ability to enable or disable 
programmatically from within `TSPluginInit` the dynamic reloading when the same 
Dynamic Share Object (DSO) is used as a remap plugin as well, overriding 
`proxy.config.plugin.dynamic_reload_mode` configuration variable.
   
   Also can we document its return code, so the function user would not have 
read the code to see that it would return `TS_ERROR` if it is not called from 
inside `TSPluginInit`? Even test that in a unit-test?

##########
File path: include/ts/ts.h
##########
@@ -162,6 +162,15 @@ int TSTrafficServerVersionGetPatch(void);
  */
 tsapi TSReturnCode TSPluginRegister(const TSPluginRegistrationInfo 
*plugin_info);
 
+/**
+   For plugins that are Global and Remap this function should be used to

Review comment:
       Same problem here, it does not enable disable plugin reload for global 
plugins since they are not reloadable, it affects only Remap Plugin reloading, 
may be we can be detailed here again:
   > This API call actually provides the ability to enable or disable 
programmatically from within TSPluginInit the dynamic reloading when the same 
Dynamic Share Object (DSO) is used as a remap plugin as well, overriding 
proxy.config.plugin.dynamic_reload_mode configuration variable.

##########
File path: src/traffic_server/InkAPI.cc
##########
@@ -1966,6 +1966,23 @@ TSPluginRegister(const TSPluginRegistrationInfo 
*plugin_info)
   return TS_SUCCESS;
 }
 
+////////////////////////////////////////////////////////////////////

Review comment:
       You have already properly added oxygen documentation in `ts.h` (we could 
do it either here or in the header to avoid updating 2 places). It seems that 
in this file this comment style is often used for documenting a group of 
functions, may be we can come up with more generic comment here?

##########
File path: include/ts/ts.h
##########
@@ -162,6 +162,15 @@ int TSTrafficServerVersionGetPatch(void);
  */
 tsapi TSReturnCode TSPluginRegister(const TSPluginRegistrationInfo 
*plugin_info);
 
+/**
+   For plugins that are Global and Remap this function should be used to
+   disable the dynamic reload mechanism for caller plugin.
+
+   @param enabled boolean flag. 0/false will disable the reload on the caller 
plugin.
+   @return TS_ERROR if failed.

Review comment:
       May be specify why would it fail? (not called as expected from 
`TSPluginInit`)




----------------------------------------------------------------
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]


Reply via email to