Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ policy in [docs/versioning.md](docs/versioning.md).

### Breaking

- **The runtime's include root is `opal/`, not `smithy/`** (#201, ADR-0024;
the second of three surfaces). `#include "smithy/http/transport.h"` is now
`#include "opal/http/transport.h"`, for every runtime header and for the
test helpers under `opal/testing/`. The include guards
(`OPAL_HTTP_TRANSPORT_H_`), the `OPAL_*` macro prefix, formerly `SMITHY_*`
(`OPAL_E2E_HAVE_BEAST`), and the `opal:` prefix on the runtime's own
stderr/clog lines follow it, and generated code includes the new paths.
Migration: `#include "smithy/` → `#include "opal/` over your tree. A
header path derived from your own model's Smithy namespace
(`smithy/cpp/ruletest/…` for this repo's rules-test fixture) is yours and
stays, so if you have one, constrain the substitution to the runtime's
directories: `smithy/{core,http,json,cbor,client,server,eventstream,compression,testing}/`.
Anything that greps a log for `smithy: ` now looks for `opal: `. The Bazel
module (`@smithy_cpp`) and `SMITHY_COPTS` are unchanged here and move in
the PR that follows.
- **The runtime namespace is `opal`, not `smithy`** (#201, ADR-0024; the
first of three surfaces). Smithy is the IDL a service is described in, not
a property of its JSON codec or its HTTP transport, so `smithy::Outcome`,
Expand All @@ -28,8 +43,8 @@ policy in [docs/versioning.md](docs/versioning.md).
`smithy::protocoltests::`, and the top-level runtime types such as
`smithy::Outcome`. Smithy namespaces in `.smithy` files and the
`smithy_cpp_*_library` rules name the model and are unchanged. The
include root (`smithy/http/transport.h`) and the Bazel module
(`@smithy_cpp`) are unchanged here and move in the two PRs that follow.
include root moved in the entry above; the Bazel module (`@smithy_cpp`)
moves in the PR that follows.

### Added

Expand Down
4 changes: 2 additions & 2 deletions bazel/tests/greeter_roundtrip_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <memory>
#include <utility>

#include "smithy/client/config.h"
#include "opal/client/config.h"
#include "opal/http/loopback.h"
#include "smithy/cpp/ruletest/client.h"
#include "smithy/cpp/ruletest/server.h"
#include "smithy/http/loopback.h"

namespace smithy::cpp::ruletest {
namespace {
Expand Down
32 changes: 16 additions & 16 deletions benchmarks/beast_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

#include "example/roundtrip/rest/client.h"
#include "example/roundtrip/rest/server.h"
#include "smithy/client/config.h"
#include "smithy/http/beast_transport.h"
#include "smithy/http/socket_transport.h"
#include "smithy/testing/tls_test_identity.h"
#include "opal/client/config.h"
#include "opal/http/beast_transport.h"
#include "opal/http/socket_transport.h"
#include "opal/testing/tls_test_identity.h"

namespace {

Expand Down Expand Up @@ -105,9 +105,9 @@ void BM_BeastRoundTrip(benchmark::State& state) {
return;
}
const std::string origin = "http://127.0.0.1:" + std::to_string(transport.port());
auto client = MakeClient(origin, std::make_shared<opal::http::BeastHttpClient>(
opal::http::BeastHttpClient::Options{
.host = "127.0.0.1", .port = transport.port()}));
auto client = MakeClient(
origin, std::make_shared<opal::http::BeastHttpClient>(opal::http::BeastHttpClient::Options{
.host = "127.0.0.1", .port = transport.port()}));
RunLoop(state, client);
transport.Stop();
}
Expand All @@ -116,20 +116,20 @@ BENCHMARK(BM_BeastRoundTrip);
void BM_BeastTlsRoundTrip(benchmark::State& state) {
example::roundtrip::rest::RoundTripRestServer server(std::make_shared<EchoHandler>());
opal::http::BeastServerTransport transport({.port = 0,
.threads = 2,
.tls_certificate_chain_pem = kTestCertificatePem,
.tls_private_key_pem = kTestPrivateKeyPem});
.threads = 2,
.tls_certificate_chain_pem = kTestCertificatePem,
.tls_private_key_pem = kTestPrivateKeyPem});
if (!transport.Start(server.Handler()).ok()) {
state.SkipWithError("beast tls server failed to start");
return;
}
const std::string origin = "https://127.0.0.1:" + std::to_string(transport.port());
auto client = MakeClient(origin, std::make_shared<opal::http::BeastHttpClient>(
opal::http::BeastHttpClient::Options{
.host = "127.0.0.1",
.port = transport.port(),
.tls = true,
.tls_options = {.ca_pem = kTestCertificatePem}}));
auto client = MakeClient(
origin, std::make_shared<opal::http::BeastHttpClient>(opal::http::BeastHttpClient::Options{
.host = "127.0.0.1",
.port = transport.port(),
.tls = true,
.tls_options = {.ca_pem = kTestCertificatePem}}));
RunLoop(state, client);
transport.Stop();
}
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/request_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "example/roundtrip/rest/server.h"
#include "example/roundtrip/rpc/client.h"
#include "example/roundtrip/rpc/server.h"
#include "smithy/client/config.h"
#include "smithy/http/loopback.h"
#include "opal/client/config.h"
#include "opal/http/loopback.h"

namespace {

Expand Down
8 changes: 4 additions & 4 deletions benchmarks/serde_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

#include "example/roundtrip/rest/serde.h"
#include "example/roundtrip/rest/types.h"
#include "smithy/cbor/cbor.h"
#include "smithy/core/blob.h"
#include "smithy/core/document.h"
#include "smithy/json/json.h"
#include "opal/cbor/cbor.h"
#include "opal/core/blob.h"
#include "opal/core/document.h"
#include "opal/json/json.h"

namespace {

Expand Down
16 changes: 8 additions & 8 deletions codegen/compile-tests/streaming_compile_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#include "compile/streaming/jsonrpc/server.h"
#include "compile/streaming/rest/client.h"
#include "compile/streaming/rest/server.h"
#include "smithy/cbor/cbor.h"
#include "smithy/client/config.h"
#include "smithy/core/document.h"
#include "smithy/eventstream/envelope.h"
#include "smithy/http/loopback.h"
#include "smithy/http/message.h"
#include "smithy/http/websocket.h"
#include "smithy/http/websocket_pair.h"
#include "opal/cbor/cbor.h"
#include "opal/client/config.h"
#include "opal/core/document.h"
#include "opal/eventstream/envelope.h"
#include "opal/http/loopback.h"
#include "opal/http/message.h"
#include "opal/http/websocket.h"
#include "opal/http/websocket_pair.h"

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ private void writeHeader(CppWriter w) {
w.addInclude("<memory>");
w.addInclude("<string>");
w.addInclude("\"" + context.settings().includePrefix() + "/types.h\"");
w.addInclude("\"smithy/client/config.h\"");
w.addInclude("\"smithy/core/outcome.h\"");
w.addInclude("\"smithy/http/transport.h\"");
w.addInclude("\"opal/client/config.h\"");
w.addInclude("\"opal/core/outcome.h\"");
w.addInclude("\"opal/http/transport.h\"");

String name = clientName();
if (!streamingOperations().isEmpty()) {
w.addInclude("\"smithy/eventstream/event_stream.h\"");
w.addInclude("\"opal/eventstream/event_stream.h\"");
}
List<OperationShape> paginated =
operations().stream().filter(op -> pagination(op).isPresent()).toList();
if (!paginated.isEmpty()) {
w.addInclude("<optional>");
w.addInclude("<utility>");
w.addInclude("\"smithy/client/pagination.h\"");
w.addInclude("\"opal/client/pagination.h\"");
for (OperationShape operation : paginated) {
w.write("class $L;", paginatorName(operation));
}
Expand Down Expand Up @@ -164,7 +164,7 @@ private void writeHeader(CppWriter w) {
w.write("opal::Outcome<std::optional<$L>> Next();", outputType);
w.write("");
w.write("using Page = $L;", outputType);
w.write("/// Single-pass range over pages — contract in smithy/client/pagination.h.");
w.write("/// Single-pass range over pages — contract in opal/client/pagination.h.");
String iterator = "opal::PageIterator<" + paginatorName(operation) + ">";
w.write("$1L begin() { return $1L(this); }", iterator);
w.write("$L end() { return {}; }", iterator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* <p>Each returned {@link Symbol}'s name is the full C++ type text; the headers it needs are
* carried in the {@code headers} property (angle form {@code <vector>} or quote form {@code
* "smithy/core/blob.h"}).
* "opal/core/blob.h"}).
*/
final class CppSymbolProvider implements SymbolProvider {

Expand Down Expand Up @@ -101,7 +101,7 @@ Symbol toMemberSymbol(MemberShape member) {
boolean plain = MemberDefaults.plain(model, member);
if (recursion.isBoxed(member)) {
name = "opal::Boxed<" + name + ">";
headers.add("\"smithy/core/boxed.h\"");
headers.add("\"opal/core/boxed.h\"");
} else if (plain) {
return target;
}
Expand Down Expand Up @@ -247,7 +247,7 @@ protected Symbol getDefault(Shape shape) {

@Override
public Symbol blobShape(BlobShape shape) {
return builder("opal::Blob", Set.of("\"smithy/core/blob.h\"")).build();
return builder("opal::Blob", Set.of("\"opal/core/blob.h\"")).build();
}

@Override
Expand Down Expand Up @@ -312,12 +312,12 @@ public Symbol intEnumShape(IntEnumShape shape) {

@Override
public Symbol timestampShape(TimestampShape shape) {
return builder("opal::Timestamp", Set.of("\"smithy/core/timestamp.h\"")).build();
return builder("opal::Timestamp", Set.of("\"opal/core/timestamp.h\"")).build();
}

@Override
public Symbol documentShape(DocumentShape shape) {
return builder("opal::Document", Set.of("\"smithy/core/document.h\"")).build();
return builder("opal::Document", Set.of("\"opal/core/document.h\"")).build();
}

@Override
Expand All @@ -340,7 +340,7 @@ public Symbol mapShape(MapShape shape) {
@Override
public Symbol structureShape(StructureShape shape) {
if (shape.getId().toString().equals("smithy.api#Unit")) {
return builder("opal::Unit", Set.of("\"smithy/core/outcome.h\"")).build();
return builder("opal::Unit", Set.of("\"opal/core/outcome.h\"")).build();
}
return declared(shape);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public CppWriter apply(String filename, String namespace) {
}
}

/** Records an include in angle ({@code <vector>}) or quote ({@code "smithy/x.h"}) form. */
/** Records an include in angle ({@code <vector>}) or quote ({@code "opal/x.h"}) form. */
public CppWriter addInclude(String include) {
getImportContainer().add(include);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Event-stream detection, validation, and emission shared by the client and server generators
* (ADR-0016): an operation is streaming when its input or output carries an event-stream union
* (@streaming blobs stay unmodeled — {@link EventStreamIndex} only indexes unions). The runtime
* owns the envelope (smithy/eventstream/envelope.h); this class emits only the member-name dispatch
* owns the envelope (opal/eventstream/envelope.h); this class emits only the member-name dispatch
* and serde calls around it — one {@code Encode<Op>Event}/{@code Decode<Op>Event} pair per
* streaming operation per wire end, with the protocol supplying the payload codec expressions.
*/
Expand Down Expand Up @@ -360,9 +360,9 @@ static void writeClientStreamHelpers(
ProtocolGenerator protocol,
List<OperationShape> streamingOperations,
String clientName) {
w.addInclude("\"smithy/eventstream/envelope.h\"");
w.addInclude("\"smithy/eventstream/event_stream.h\"");
w.addInclude("\"smithy/http/websocket.h\"");
w.addInclude("\"opal/eventstream/envelope.h\"");
w.addInclude("\"opal/eventstream/event_stream.h\"");
w.addInclude("\"opal/http/websocket.h\"");
w.addInclude("<memory>");
w.write("// Dials the WebSocket a streaming operation rides (ADR-0016): host, port, and");
w.write("// TLS come from the same endpoint the unary transport uses (nothing is");
Expand Down Expand Up @@ -412,9 +412,9 @@ static void writeServerStreamHelpers(
ServiceShape service,
ProtocolGenerator protocol,
List<OperationShape> streamingOperations) {
w.addInclude("\"smithy/eventstream/envelope.h\"");
w.addInclude("\"smithy/http/websocket.h\"");
w.addInclude("\"smithy/eventstream/async_event_stream.h\"");
w.addInclude("\"opal/eventstream/envelope.h\"");
w.addInclude("\"opal/http/websocket.h\"");
w.addInclude("\"opal/eventstream/async_event_stream.h\"");
w.addInclude("<utility>");
if (protocol.streamsRideJsonRpcEnvelopes()) {
// The JSON-RPC-native wire (ADR-0023): the codec pairs are the shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ final class HttpJsonClientGenerator {

List<String> includes() {
return List.of(
"\"smithy/json/json.h\"",
"\"smithy/core/base64.h\"",
"\"smithy/http/headers.h\"",
"\"opal/json/json.h\"",
"\"opal/core/base64.h\"",
"\"opal/http/headers.h\"",
"<cstdint>",
"<cstdlib>",
"<limits>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ private static String buildResponseFunction(String opName) {

List<String> includes() {
return List.of(
"\"smithy/json/json.h\"",
"\"smithy/core/base64.h\"",
"\"smithy/core/document_serde.h\"",
"\"smithy/core/blob.h\"",
"\"smithy/http/headers.h\"",
"\"opal/json/json.h\"",
"\"opal/core/base64.h\"",
"\"opal/core/document_serde.h\"",
"\"opal/core/blob.h\"",
"\"opal/http/headers.h\"",
"<cstdint>",
"<cstdlib>",
"<limits>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ private void writeSource(CppWriter w) {
w.addInclude("<utility>");
w.addInclude("\"" + context.settings().includePrefix() + "/client.h\"");
w.addInclude("\"" + context.settings().includePrefix() + "/server.h\"");
w.addInclude("\"smithy/client/config.h\"");
w.addInclude("\"smithy/http/loopback.h\"");
w.addInclude("\"smithy/http/socket_transport.h\"");
w.addInclude("\"smithy/testing/protocol_test.h\"");
w.addInclude("\"opal/client/config.h\"");
w.addInclude("\"opal/http/loopback.h\"");
w.addInclude("\"opal/http/socket_transport.h\"");
w.addInclude("\"opal/testing/protocol_test.h\"");
if (protocol.contentType().equals("application/cbor")) {
w.addInclude("\"smithy/cbor/cbor.h\"");
w.addInclude("\"smithy/core/blob.h\"");
w.addInclude("\"opal/cbor/cbor.h\"");
w.addInclude("\"opal/core/blob.h\"");
} else {
w.addInclude("\"smithy/json/json.h\"");
w.addInclude("\"opal/json/json.h\"");
}

String name = serviceName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public List<String> runtimeDeps() {

@Override
public List<String> clientIncludes() {
return List.of("\"smithy/json/json.h\"", "\"smithy/core/document.h\"");
return List.of("\"opal/json/json.h\"", "\"opal/core/document.h\"");
}

@Override
Expand Down Expand Up @@ -253,8 +253,7 @@ public void writeStreamSessionRoutes(

@Override
public List<String> serverIncludes() {
return List.of(
"\"smithy/json/json.h\"", "\"smithy/core/document.h\"", "\"smithy/http/headers.h\"");
return List.of("\"opal/json/json.h\"", "\"opal/core/document.h\"", "\"opal/http/headers.h\"");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private JsonRpc2StreamCodeGen() {}
* the opening-envelope parse with the unary endpoint's exact refusal strings.
*/
static void writeSharedServerHelpers(CppWriter w) {
w.addInclude("\"smithy/eventstream/jsonrpc_stream_socket.h\"");
w.addInclude("\"opal/eventstream/jsonrpc_stream_socket.h\"");
w.write("// One JSON-RPC envelope as the raw-text message the stream wire carries");
w.write("// (ADR-0023): the unary emitters build the envelope, streams reuse their");
w.write("// bodies verbatim — one error identity, one spelling.");
Expand Down Expand Up @@ -327,7 +327,7 @@ static void writeStreamingOperationBody(
ServiceShape service,
ProtocolGenerator protocol,
OperationShape operation) {
w.addInclude("\"smithy/eventstream/jsonrpc_stream_socket.h\"");
w.addInclude("\"opal/eventstream/jsonrpc_stream_socket.h\"");
StructureShape input = ProtocolSupport.inputShape(context, operation);
String op = EventStreamCodeGen.opName(operation);
w.write("opal::http::WebSocketDialRequest request;");
Expand Down
Loading
Loading