]> git.ipfire.org Git - thirdparty/squid.git/commit
API to separate Config.x users/parsers from Config.y details (#811)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 8 May 2021 07:51:32 +0000 (07:51 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 9 May 2021 08:05:03 +0000 (08:05 +0000)
commit2e6535ab844258c37966957924d74144eb62a5bf
treeddec9e9bc17654b60937304393a6a1b293e62523
parentf70aedc41741c5475ca5f7d86234e7e6366c8be9
API to separate Config.x users/parsers from Config.y details (#811)

The new API avoids several kinds of unwanted code dependencies:

* Config.x users do not need to know the type of any Config.y component.
  Forward declarations of Config.y types are sufficient.

* Config.x parsers do not need to know about Config.y parsers. Config.x
  parsers can also be hidden from Config.x users.

* The centralized parsing code does not need to contain Config.x parsing
  code (for any x) and does not maintain "generic" parser registration.
  The compiler/linker do that for us _without_ losing C++ type safety.

Correct API implementation may also help separate the active Config
object from the being-parsed configuration, to eventually support safe
"hot" reconfiguration.

This change does not convert any existing Config fields and does not
imply a policy that existing fields must be converted when touched.

The API was tested on a typical new Config.x component (to be merged
separately). It is likely to evolve, especially when support for
multi-directive components is added.

Activated by using TYPE names with two colons (e.g., TYPE: Security::X).
src/ConfigOption.h
src/ConfigParser.cc
src/ConfigParser.h
src/cache_cf.cc
src/cf_gen.cc