A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
describe_endpoint.h File Reference

GET /actions, on whichever server happens to hold the port. More...

#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <absl/base/nullability.h>
#include <absl/status/statusor.h>
#include "a11/concurrency/future.h"
#include "a11/net/http2.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  a11::net::DescribeEndpointOptions
 Where and whether a server answers discovery over plain HTTP. More...
 

Namespaces

namespace  a11
 
namespace  a11::net
 

Typedefs

using a11::net::DescribeActionsHandler = std::function< absl::StatusOr< std::string >(std::string_view name, std::string_view query)>
 Answers a discovery request without opening a wire stream.
 

Functions

bool a11::net::MatchDescribePath (std::string_view path, const DescribeEndpointOptions &options, std::string *absl_nonnull name)
 Whether path addresses the describe endpoint, and what it names.
 
std::optional< a11::Task > a11::net::TryDescribeOverHttp (const DescribeEndpointOptions &options, const HttpRequest &request, const std::shared_ptr< Http2ResponseWriter > &response, HttpHeaders extra_headers={})
 Answers request from options, if it is addressed to it.
 
std::string_view a11::net::QueryOfPath (std::string_view path)
 The query part of path, without the ?.
 

Variables

constexpr std::string_view a11::net::kDefaultDescribeEndpoint = "/actions"
 Default path serving the action descriptors.
 

Detailed Description

GET /actions, on whichever server happens to hold the port.

A11 is a protocol before it is an HTTP API, and discovery is an action (__list_actions__) that works over every transport. These endpoints exist anyway, because a service is a thing people curl, and because the answer to "what is listening on 8011" should not require an A11 client to ask.

Why a function and not a registry. a11::net sits below a11::actions – the dependency runs net -> actions, never back – so an options struct here cannot hold an ActionRegistry. What it holds instead is a callback the layer above fills in, which has the useful side effect that the endpoint and the action are answered by the same describer and so cannot disagree.