rob05c commented on a change in pull request #7023: URL: https://github.com/apache/trafficserver/pull/7023#discussion_r469693966
########## File path: include/ts/parentresult.h ########## @@ -0,0 +1,48 @@ +/** @file + + @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 "ts/apidefs.h" +#include "tscore/ConsistentHash.h" + +// Needed by core. Disabling the warning for plugins +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +static const char *ParentResultStr[] = {"PARENT_UNDEFINED", "PARENT_DIRECT", "PARENT_SPECIFIED", "PARENT_AGENT", "PARENT_FAIL"}; +#pragma GCC diagnostic pop + +struct TSParentResult { + const char *hostname; + int port; + bool retry; + TSParentResultType result; + bool chash_init[TS_MAX_GROUP_RINGS] = {false}; Review comment: Yeah, the object is C++, unfortunately. This is an API version of a core struct that already exists. If it's changed here, moving the data between the API and core will have to translate between them, and will probably be less efficient. Alternatively, I could change it in core. It looks like that wouldn't be too invasive. I haven't benchmarked, but it was my understanding that std::bitset is optimized for space, and is often less performant than `bool[]` or bitmasking. Notwithstanding, I'd still prefer to do a bitmask, because the struct only has one C++ member, and I'd like to move it in the direction of C for the sake of the API. ---------------------------------------------------------------- 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]
