Yes, that makes sense, if you are reading the var name and value from a JSON/YAML config file, you might want to accept an integral value for a float var, without causing an error. I was just wondering if Dr. Zret had other uses in mind.
On Mon, Sep 28, 2020 at 5:07 PM Damian Meden <damian.me...@verizonmedia.com> wrote: > > for example, the name is passed as a plugin parameter or in a > plugin config file? > > yes, that could be an example in my pov. Now, I will not speak about > TxnBox, but in in general unless you know the type of the record you will > not get the right value, AFAICT, currently if you request for a `string` > and the data type was set to `int` you will get an ERROR from the > librecords and not the value as string, even when it can be converted, so > you need to specify the type of it. > So with this API, and not knowing the type before hand, you request the > type and call the appropriated Get (TSMgmtIntGet, TSMgmtStringGet, etc). > > As someone who implemented something similar but for the internal > RPC(jsonrpc) this function could be handy. > > > Thanks, > Damian. > > On Mon, Sep 28, 2020 at 10:02 PM Walt Karas > <wka...@verizonmedia.com.invalid> wrote: > >> You mean, for example, the name is passed as a plugin parameter or in a >> plugin config file? Is this for txn box? Is it obvious to everyone but >> me >> that a use for this will come up? >> >> On Mon, Sep 28, 2020 at 3:59 PM Alan Carroll >> <solidwallofc...@verizonmedia.com.invalid> wrote: >> >> > No, it's for handling cases where the configuration variable name is not >> > known at compile time. >> > >> > On Mon, Sep 28, 2020 at 3:46 PM Walt Karas <wka...@verizonmedia.com >> > .invalid> >> > wrote: >> > >> > > So, more concretely, is it for future safety? For example, if the >> value >> > is >> > > a percentage, and it's currently an int, but you suspect it may need >> to >> > > become a float? >> > > >> > > On Mon, Sep 28, 2020 at 2:43 PM Alan Carroll >> > > <solidwallofc...@verizonmedia.com.invalid> wrote: >> > > >> > > > Suppose you want to fetch a configuration value, and want to know >> > whether >> > > > to call TSMgmtIntGet or *TSMgmtFloatGet*. There is currently no way >> to >> > > know >> > > > programmatically. The code has to "just know" which it is. >> > > > >> > > > On Mon, Sep 28, 2020 at 2:10 PM Walt Karas <wka...@verizonmedia.com >> > > > .invalid> >> > > > wrote: >> > > > >> > > > > Can you describe an example situation where this would be useful? >> > > > > >> > > > > On Mon, Sep 28, 2020 at 1:59 PM Damian Meden >> > > > > <damian.me...@verizonmedia.com.invalid> wrote: >> > > > > >> > > > > > Hi Guys. >> > > > > > >> > > > > > I would like to propose adding a new API function to bring the >> > record >> > > > > data >> > > > > > type from a particular record. >> > > > > > >> > > > > > A brief description of this new proposed API: >> > > > > > >> > > > > > >> > > > > > *TSReturnCode TSMgmtDataTypeGet(const char >> > > > > > * var_name, TSRecordDataType * result)* >> > > > > > >> > > > > > Get the type of a value for a configuration variable. >> *var_name* is >> > > the >> > > > > > name of the variable as a null terminated string. The type >> value is >> > > > > stored >> > > > > > in *result*. The function can return TS_ERROR >> > > > > > <../types/TSReturnCode.en.html#c.TS_ERROR> if *var_name* is not >> > > found. >> > > > > > >> > > > > > --- >> > > > > > >> > > > > > You can find a PR < >> > > > > > >> > > > > >> > > > >> > > >> > >> https://urldefense.com/v3/__https://github.com/apache/trafficserver/pull/7221__;!!Op6eflyXZCqGR5I!Ut1BdGvMMt4kxU3dMtGgLg5r7widT_I1IxhJJQbnf4ufwrvTVOjPJLfBwL-fYhfMWw$ >> > > > > > > with >> > > > > > this change to complement this request: >> > > > > > >> > > > > > Best Regards, >> > > > > > Damian. >> > > > > > >> > > > > >> > > > >> > > >> > >> >