You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "brbzull0 (via GitHub)" <gi...@apache.org> on 2023/05/23 10:44:51 UTC
[GitHub] [trafficserver] brbzull0 commented on a diff in pull request #9599: TS API - records.yaml Add API to parse YAML nodes that are expected to be read as legacy records.
brbzull0 commented on code in PR #9599:
URL: https://github.com/apache/trafficserver/pull/9599#discussion_r1202053619
##########
doc/developer-guide/api/functions/TSRecYAMLConfigParse.en.rst:
##########
@@ -0,0 +1,147 @@
+.. 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
+
+TSYAMLRecCfgFieldData
+*********************
+
+Parse a record yaml file.
+
+Synopsis
+========
+
+.. code-block:: cpp
+
+ #include <ts/ts.h>
+ #include <ts/apidefs.h>
+
+.. type:: TSYAMLRecCfgFieldData
+
+ Configuration field info.
+
+.. type:: TSReturnCode (*TSYAMLRecNodeHandler)(const TSYAMLRecCfgFieldData *cfg, void *data);
+
+ Record field callback (called on every parsed record field(last node field on each YAML map))
+
+.. function:: TSReturnCode TSRecYAMLConfigParse(TSYaml node, TSYAMLRecNodeHandler handler, void *data);
+
+ Parse a YAML node following the record structure. Handler will be called on every final field.
+
+
+Description
+===========
+
+
+ ``TSYAMLRecCfgFieldData``
+
+ This contains information about the parsed record field. This will be passed back to the `TSYAMLRecNodeHandler`
+ when you call `TSRecYAMLConfigParse`. This class holds the record name as well as the YAML node in case the caller
+ wants to use this information to manipulate the record.
+
+.. var:: const char* field_name
+
+ A null-terminated string with the YAML field name. This holds the name of the scalar field. This is mostly to be used for logging.
+
+.. var:: const char* record_name
+
+ A null-terminated string with the record name which was built when parsing the YAML file. Example: `proxy.config.diags.debug.enabled`.
Review Comment:
>What if the record isn't defined? Is there some mark for that?
Caller should check if the record exist or not as in parsing a regular old `.config` file, so a plugin should check this for instance by calling `TSHttpTxnConfigFind` as you said.
I think I should add a note for this in the docs.
--
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.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org