Hi, I'd like to propose new APIs for record reading functions which
return std::optional<T>.

std::optional<RecInt>      RecGetRecordInt(const char *name, bool lock = true);
std::optional<RecFloat>    RecGetRecordFloat(const char *name, bool
lock = true);
RecErrT                    RecGetRecordString(const char *name, char
*buf, int buf_len, bool lock = true);
std::optional<std::string> RecGetRecordStringAlloc(const char *name,
bool lock = true);
std::optional<RecCounter>  RecGetRecordCounter(const char *name, bool
lock = true);

std::optional::has_value() for the result returns true if the value is
found or false otherwise.
The third API is unmodified from the current API.

The prerequisite for these APIs is to prohibit using nullptr as the
default value of string records.
Therefore we need to change the default value of  proxy.config.diags.action.tags
from nullptr to an empty string "".

For details, please take a look at
https://github.com/apache/trafficserver/pull/12060#issuecomment-2763533666
and the comments above it.

I would appreciate any feedback on this proposal.
Thanks,

-- 
)Hioraki Nakamura) hnaka...@gmail.com

Reply via email to