Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/workerd/api/r2-bucket.c++
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@
#include <regex>

namespace workerd::api::public_beta {
kj::Own<kj::HttpClient> r2GetClient(
IoContext& context, uint subrequestChannel, R2UserTracing user) {
TraceContext traceContext = context.makeUserTraceSpan(user.op);
traceContext.setTag("rpc.service"_kjc, "r2"_kjc);
traceContext.setTag(user.method.key, user.method.value);
KJ_IF_SOME(b, user.bucket) {
traceContext.setTag("cloudflare.r2.bucket"_kjc, b);
}
KJ_IF_SOME(tag, user.extraTag) {
traceContext.setTag(tag.key, tag.value);
}

// TODO(o11y): Attach trace context to awaitIo call to match operation lifetime better?
return context.getHttpClient(subrequestChannel, true, kj::none, traceContext)
.attach(kj::mv(traceContext));
}

kj::Own<kj::HttpClient> R2Bucket::getHttpClient(IoContext& context, TraceContext& traceContext) {
KJ_SWITCH_ONEOF(clientChannel) {
Expand Down
18 changes: 0 additions & 18 deletions src/workerd/api/r2-bucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ class Headers;

namespace workerd::api::public_beta {

struct StringTagParams {
kj::LiteralStringConst key;
kj::StringPtr value;
};

struct R2UserTracing {
kj::LiteralStringConst op;
StringTagParams method;
// Passing Maybe<kj::StringPtr> instead of Maybe<StringTagParams> here – this avoids a branch on
// the caller side when bucket is already a Maybe, which is more convenient.
kj::Maybe<kj::StringPtr> bucket;
kj::Maybe<StringTagParams> extraTag;
};

// Helper for creating R2 HTTP Client with the right span tags across operations. This is much
// cleaner than setting span tags directly in each function.
kj::Own<kj::HttpClient> r2GetClient(IoContext& context, uint subrequestChannel, R2UserTracing user);

kj::ArrayPtr<kj::StringPtr> fillR2Path(
kj::StringPtr pathStorage[1], const kj::Maybe<kj::String>& bucket);

Expand Down
1 change: 0 additions & 1 deletion src/workerd/api/r2-rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ kj::Promise<R2Result> doR2HTTPPutRequest(jsg::Lock& js,
kj::Own<kj::HttpClient> client,
kj::Maybe<R2PutValue> value,
kj::Maybe<uint64_t> streamSize,
// Deprecated. For internal beta API only.
kj::String metadataPayload,
kj::ArrayPtr<kj::StringPtr> path,
kj::Maybe<kj::StringPtr> jwt);
Expand Down
14 changes: 7 additions & 7 deletions src/workerd/io/compatibility-date-test.c++
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ KJ_TEST("compatibility flag parsing") {
[](kj::StringPtr compatDate, kj::ArrayPtr<const kj::StringPtr> featureFlags,
kj::StringPtr expectedOutput, kj::ArrayPtr<const kj::StringPtr> expectedErrors = nullptr,
CompatibilityDateValidation dateValidation = CompatibilityDateValidation::FUTURE_FOR_TEST,
bool r2InternalBetaApiSet = false, bool experimental = false,
bool r2InternalBetaBindingsSet = false, bool experimental = false,
kj::ArrayPtr<const kj::StringPtr> allowedExperimentalFlags = nullptr) {
capnp::MallocMessageBuilder message;
auto orphanage = message.getOrphanage();
Expand All @@ -95,10 +95,10 @@ KJ_TEST("compatibility flag parsing") {
capnp::TextCodec codec;
auto parsedExpectedOutput = codec.decode<CompatibilityFlags>(expectedOutput, orphanage);

if (!r2InternalBetaApiSet) {
// The r2PublicBetaApi is always expected by default regardless of compat date unless
// explicitly disabled.
parsedExpectedOutput.get().setR2PublicBetaApi(true);
if (!r2InternalBetaBindingsSet) {
// obsolete13 is always expected by default regardless of compat date unless explicitly
// disabled with r2_internal_beta_bindings.
parsedExpectedOutput.get().setObsolete13(true);
}

// If errors are expected, then the output is irrelevant.
Expand Down Expand Up @@ -230,7 +230,7 @@ KJ_TEST("compatibility flag parsing") {
" specCompliantUrl = true,"
" globalNavigator = true,"
" captureThrowsAsRejections = true,"
" r2PublicBetaApi = true,"
" obsolete13 = true,"
" obsolete14 = false,"
" noSubstituteNull = true,"
" transformStreamJavaScriptControllers = true,"
Expand Down Expand Up @@ -288,7 +288,7 @@ KJ_TEST("compatibility flag parsing") {
" specCompliantUrl = true,"
" globalNavigator = true,"
" captureThrowsAsRejections = true,"
" r2PublicBetaApi = true,"
" obsolete13 = true,"
" obsolete14 = false,"
" noSubstituteNull = true,"
" transformStreamJavaScriptControllers = true,"
Expand Down
6 changes: 3 additions & 3 deletions src/workerd/io/compatibility-date.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ struct CompatibilityFlags @0x8f8c1b68151b6cef {
# throw synchronously. This flag changes the behavior so that async functions return
# rejections instead of throwing.

r2PublicBetaApi @13 :Bool
obsolete13 @13 :Bool
$compatEnableFlag("r2_public_beta_bindings")
$compatDisableFlag("r2_internal_beta_bindings")
$compatEnableAllDates;
# R2 public beta bindings are the default.
# R2 internal beta bindings is back-compat.
# Obsolete flag. Has no effect. The R2 bindings that `r2_internal_beta_bindings` used to select
# no longer exist, so all workers get the same R2 API regardless of this flag.

obsolete14 @14 :Bool
$compatEnableFlag("durable_object_alarms");
Expand Down
Loading