Skip to content

Commit

Permalink
dnsdist: Rename factories as factory
Browse files Browse the repository at this point in the history
  • Loading branch information
rgacogne committed Dec 23, 2024
1 parent c5e78a8 commit 5bf9e88
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions pdns/dnsdistdist/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ dnslabeltext.cc: dnslabeltext.rl
$(AM_V_GEN)$(RAGEL) $< -o dnslabeltext.cc

BUILT_SOURCES=htmlfiles.h \
dnsdist-actions-factories-generated.cc dnsdist-actions-factories-generated.hh \
dnsdist-actions-factory-generated.cc dnsdist-actions-factory-generated.hh \
dnsdist-lua-ffi-interface.inc \
dnsdist-lua-actions-generated.cc dnsdist-lua-response-actions-generated.cc \
dnsdist-response-actions-factories-generated.cc dnsdist-response-actions-factories-generated.hh \
dnsdist-response-actions-factory-generated.cc dnsdist-response-actions-factory-generated.hh \
dnsdist-rust-bridge-actions-generated.cc dnsdist-rust-bridge-actions-generated.hh \
dnsdist-rust-bridge-selectors-generated.cc dnsdist-rust-bridge-selectors-generated.hh \
dnsdist-selectors-factory-generated.cc dnsdist-selectors-factory-generated.hh \
Expand Down Expand Up @@ -171,8 +171,8 @@ dnsdist_SOURCES = \
dns.cc dns.hh \
dns_random.hh \
dnscrypt.cc dnscrypt.hh \
dnsdist-actions-factories-generated.hh \
dnsdist-actions-factories.cc dnsdist-actions-factories.hh \
dnsdist-actions-factory-generated.hh \
dnsdist-actions-factory.cc dnsdist-actions-factory.hh \
dnsdist-actions.cc dnsdist-actions.hh \
dnsdist-async.cc dnsdist-async.hh \
dnsdist-backend.cc dnsdist-backend.hh \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
#include <unordered_map>

#include "dnsdist-actions-factories.hh"
#include "dnsdist-actions-factory.hh"

#include "config.h"
#include "dnsdist.hh"
Expand Down Expand Up @@ -2427,6 +2427,6 @@ std::shared_ptr<DNSAction> getTeeAction(const ComboAddress& rca, std::optional<C
return std::shared_ptr<DNSAction>(new TeeAction(rca, lca, addECS, addProxyProtocol));
}

#include "dnsdist-actions-factories-generated.cc"
#include "dnsdist-response-actions-factories-generated.cc"
#include "dnsdist-actions-factory-generated.cc"
#include "dnsdist-response-actions-factory-generated.cc"
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ struct SOAParams
uint32_t minimum;
};

#include "dnsdist-actions-factories-generated.hh"
#include "dnsdist-response-actions-factories-generated.hh"
#include "dnsdist-actions-factory-generated.hh"
#include "dnsdist-response-actions-factory-generated.hh"

std::shared_ptr<DNSAction> getContinueAction(std::shared_ptr<DNSAction> action);
#ifdef HAVE_DNS_OVER_HTTPS
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsdistdist/dnsdist-configuration-yaml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#if defined(HAVE_YAML_CONFIGURATION)
#include "base64.hh"
#include "dolog.hh"
#include "dnsdist-actions-factories.hh"
#include "dnsdist-actions-factory.hh"
#include "dnsdist-backend.hh"
#include "dnsdist-cache.hh"
#include "dnsdist-discovery.hh"
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsdistdist/dnsdist-lua-actions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
#include "config.h"
#include "dnsdist.hh"
#include "dnsdist-actions-factories.hh"
#include "dnsdist-actions-factory.hh"
#include "dnsdist-lua.hh"
#include "dnsdist-lua-ffi.hh"
#include "dnsdist-protobuf.hh"
Expand Down
30 changes: 15 additions & 15 deletions pdns/dnsdistdist/dnsdist-rules-generator.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/python3
"""Load action and selector definitions and generates C++ factories and Lua bindings code."""
"""Load action and selector definitions and generates C++ factory and Lua bindings code."""
# 1/ Loads the action definitions from:
# - dnsdist-actions-definitions.yml
# - dnsdist-response-actions-definitions.yml
# and generates C++ factories to create the objects
# and generates C++ factory to create the objects
# for these actions from the corresponding parameters:
# - dnsdist-actions-factories-generated.cc
# - dnsdist-actions-factories-generated.hh
# - dnsdist-response-actions-factories-generated.cc
# - dnsdist-response-actions-factories-generated.hh
# - dnsdist-actions-factory-generated.cc
# - dnsdist-actions-factory-generated.hh
# - dnsdist-response-actions-factory-generated.cc
# - dnsdist-response-actions-factory-generated.hh
# as well as Lua bindings for them:
# - dnsdist-lua-actions-generated.cc
# - dnsdist-lua-response-actions-generated.cc
# 2/ Loads the selector definitions from:
# - dnsdist-selectors-definitions.yml
# and generates C++ factories to create the objects
# and generates C++ factory to create the objects
# for these selectors from the corresponding parameters:
# - dnsdist-selectors-factory-generated.cc
# - dnsdist-selectors-factory-generated.hh
Expand Down Expand Up @@ -145,7 +145,7 @@ def get_temporary_file_for_generated_code():
generated_fp.write('// !! This file has been generated by dnsdist-rules-generator.py, do not edit by hand!!\n')
return generated_fp

def generate_actions_factories_header(definitions, response=False):
def generate_actions_factory_header(definitions, response=False):
suffix = 'ResponseAction' if response else 'Action'
shared_object_type = f'DNS{suffix}'
generated_fp = get_temporary_file_for_generated_code()
Expand All @@ -160,10 +160,10 @@ def generate_actions_factories_header(definitions, response=False):
output += ');\n'
generated_fp.write(output)

output_file_name = 'dnsdist-response-actions-factories-generated.hh' if response else 'dnsdist-actions-factories-generated.hh'
output_file_name = 'dnsdist-response-actions-factory-generated.hh' if response else 'dnsdist-actions-factory-generated.hh'
os.rename(generated_fp.name, output_file_name)

def generate_actions_factories(definitions, response=False):
def generate_actions_factory(definitions, response=False):
suffix = 'ResponseAction' if response else 'Action'
generated_fp = get_temporary_file_for_generated_code()

Expand All @@ -182,7 +182,7 @@ def generate_actions_factories(definitions, response=False):
output += '}\n'
generated_fp.write(output)

output_file_name = 'dnsdist-response-actions-factories-generated.cc' if response else 'dnsdist-actions-factories-generated.cc'
output_file_name = 'dnsdist-response-actions-factory-generated.cc' if response else 'dnsdist-actions-factory-generated.cc'
os.rename(generated_fp.name, output_file_name)

def generate_lua_actions_bindings(definitions, response=False):
Expand Down Expand Up @@ -267,13 +267,13 @@ def generate_lua_selectors_bindings(definitions):

def main():
definitions = get_definitions_from_file('dnsdist-actions-definitions.yml')
generate_actions_factories_header(definitions)
generate_actions_factories(definitions)
generate_actions_factory_header(definitions)
generate_actions_factory(definitions)
generate_lua_actions_bindings(definitions)

definitions = get_definitions_from_file('dnsdist-response-actions-definitions.yml')
generate_actions_factories_header(definitions, response=True)
generate_actions_factories(definitions, response=True)
generate_actions_factory_header(definitions, response=True)
generate_actions_factory(definitions, response=True)
generate_lua_actions_bindings(definitions, response=True)

definitions = get_definitions_from_file('dnsdist-selectors-definitions.yml')
Expand Down

0 comments on commit 5bf9e88

Please sign in to comment.