# A protocol plugin written in plain C, loaded over loadr's frozen C ABI.
#
# Unlike the Rust native plugins (mongo/redis/...), `c-echo` is a C shared
# library exporting four `extern "C"` symbols — proving loadr plugins can be
# authored in non-Rust languages. The host auto-detects the C ABI at load time.
# It serves the `cecho://` scheme and echoes each request body back, status 200.
#
# Build + install the plugin, then run:
#   make -C examples/plugins/c-echo
#   mkdir -p dist && cp examples/plugins/c-echo/plugin.toml dist/ \
#     && cp examples/plugins/c-echo/libloadr_plugin_cecho.so dist/
#   loadr plugin install dist
#   loadr run examples/34-c-echo.yaml
#
# Or point the plan's `plugins:` entry at the built artifact directly:
#   plugins:
#     - { name: cecho, path: examples/plugins/c-echo/libloadr_plugin_cecho.so }
name: c-echo
description: echo protocol via a plain-C (C-ABI) loadr plugin

plugins:
  # Resolve `cecho` by name from the plugins dir (after `loadr plugin install`).
  - name: cecho

scenarios:
  echo:
    executor: constant-vus
    vus: 4
    duration: 5s
    flow:
      - request:
          name: echo a payload
          # No `protocol:` needed: the plugin claims the `cecho://` scheme.
          url: cecho://localhost/whatever
          method: SEND
          body: "ping-from-loadr-${vu}-${iteration}"
          assert:
            - { type: status, equals: 200 }                 # 200 = ok
            - { type: body_contains, value: "ping-from-loadr" }
