#
# strategies.yaml
#
# Documentation:
#    https://docs.trafficserver.apache.org/en/latest/admin-guide/files/strategies.yaml.en.html
#
# The purpose of this file is to specify the strategies available for
#   use in locating upstream caches for use to satisfy requests
#
# This is a YAML formatted file to define hosts, groups of hosts and next hop strategies that
# may be used by remap
#
# There are three top-level YAML name spaces: 'hosts', 'groups', and 'strategies'.
#   'hosts' is a YAML list of host's definitions and is used when defining 'groups' YAML
#     references are supported.
#   'groups' is a YAML list that aggregates a group of hosts together and serves as the
#     equivalent to the rings used in parent.config.  You may define up to five groups in a
#     config, see MAX_GROUPS.
#   'strategies' is a YAML list of strategy definitions.
#
# Files may be broken up into several different files.  The main file loaded by the Next Hop
# Strategy factory is this file, strategies.yaml.  You may move the 'hosts' and 'groups'
# definitions into separate files and then include them in this file using:
#
#   '#include path_to_hosts_and_groups_file'
#
# It is even possible to put individual strategies into separate file.  The Next Hop
# strategy factory  concatenates all included files together in a single YAML document at
# each point where it sees an '#include file_name'.  When using this feature you just need to
# ensure that the final concatenation is a valid YAML document with 'hosts', 'groups'
# and 'strategies' in this given order.
#
#
# This example YAML document shows a complete definition in a single strategies.yaml
# file.  There are other example unit test files in the source tree showing examples of
# using '#include' and different formats available for use, proxy/http/remap/unit-tests/
# See the documentation which describes each parameter in detail.
#
# Example:
#
#
# hosts:
#   - &p1
#     host: p1.foo.com
#     hash_string: slsklslsk # optional hash string that replaces the hostname in consistent hashing.
#     protocol:
#       - scheme: http
#         port:  80
#         health_check_url: http://192.168.1.1:80
#       - scheme: https
#         port: 443
#         health_check_url: https://192.168.1.1:443
#   - &p2
#     host: p2.foo.com
#     protocol:
#       - scheme: http
#         port: 80
#         health_check_url: http://192.168.1.2:80
#       - scheme: https
#         port: 443
#         health_check_url: https://192.168.1.2:443
#   - &s1
#     host: s1.foo.com
#     hash_string: slsklslsk # optional hash string that replaces the hostname in consistent hashing.
#     protocol:
#       - scheme: http
#         port: 80
#         health_check_url: http://192.168.2.1:80
#       - scheme: https
#         port: 443
#         health_check_url: https://192.168.2.1:443
#   - &s2
#     host: s2.foo.com
#     protocol:
#       - scheme: http
#         port: 80
#         health_check_url: http://192.168.2.2:80
#       - scheme: https
#         port: 443
#         health_check_url: https://192.168.2.2:443
# groups:
#   - &g1
#     - <<: *p1
#       weight: 0.5
#     - <<: *p2
#       weight: 0.5
#   - &g2
#     - <<: *s1
#       weight: 2.0
#     - <<: *s2
#       weight: 1.0
# strategies:
#   - strategy: 'mid-tier-north'
#     policy: rr_ip # Selection strategy policy: Enum of 'consistent_hash' or 'first_live' or 'rr_strict' or 'rr_ip' or 'latched'
#     hash_key: hostname # optional key to use for Hashing. Enum of 'url' or 'uri' or 'hostname' or 'path' or 'path+query' or 'cache_key' or 'path+fragment'
#     go_direct: true # transactions may routed directly to the origin true/false default is true.
#     parent_is_proxy: false  # next hop hosts  are origin servers when set to 'false', defaults to true and indicates next hop hosts are ats cache's.
#     cache_peer_result: true # only used when the 'ring_mode' is set to 'peering_ring' and the policy is 'consistent_hash'.  The default value is
#                        true which means to always allow caching responses.  When set to 'false' responses received from peer hosts will not be
#                        cached, only responses received from upstream parents or origins will be cached.
#     groups: # groups of hosts, these groups are used as rings in consistent hash and arrays of host groups for round_robin.
#       - *g1
#       - *g2
#     scheme: http
#     failover:
#       max_simple_retries: 2 # default is 1, indicates the maximum number of simple retries for the listed response codes.
#       ring_mode: exhaust_ring # enumerated as exhaust_ring, alternate_ring, or peering_ring
#           #1) in 'exhaust_ring' mode all the servers in a ring are exhausted before failing over to secondary ring
#           #2) in 'alternate_ring' mode causes the failover to another server in secondary ring.
#           #3) 'peering_ring' is implemented for only a policy of 'consistent_hash' and requires that the strategy
#               has two host groups defined.  The first group is the 'peer' group of caches that also includes this host
#               itself.  The second group is the 'upstream' group of caches.  All parent host lookups are looked up from
#               the peer group using consistent hashing.  If the resolved parent is "this" host, a new parent from the
#               upstream list using consistent hashing will be chosen instead.  If any of the peer caches are
#               unreachable or timeout, a new parent is chosen from the upstream list for retries.
#       response_codes: # defines the responses codes for failover in exhaust_ring mode
#         - 404
#         - 502
#         - 503
#       health_check: # specifies the list of health checks that should be considered for failover. A list of enums: 'passive' or 'active'
#         - passive
#         - active
#   - strategy: 'mid-tier-south'
#     policy: latched
#     hash_key: uri
#     go_direct: false
#     parent_is_proxy: false  # next hop hosts  are origin servers
#     groups:
#       - *g1
#       - *g2
#     scheme: https
#     failover:
#       max_simple_retries: 2
#       ring_mode: alternate_ring
#       response_codes:
#         - 404
#         - 502
#         - 503
#       health_check:
#         - passive
#         - active
