Skip to content

Commit 3274cc9

Browse files
authored
Remove the autogate for using StateMachine in CompressionStream (#6072)
Autogate is deployed
1 parent 6789c43 commit 3274cc9

File tree

3 files changed

+0
-67
lines changed

3 files changed

+0
-67
lines changed

src/workerd/api/streams/compression.c++

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -466,63 +466,10 @@ class CompressionStreamBase: public kj::Refcounted,
466466
RingBuffer<PendingRead, 8> pendingReads;
467467
};
468468

469-
// Uncompressed data goes in. Compressed data comes out.
470-
// TODO(cleanup): Once the autogate is removed, delete this class and merge CompressionStreamBase
471-
// and CompressionStreamImplV2 back into a single class.
472469
template <Context::Mode mode>
473470
class CompressionStreamImpl final: public CompressionStreamBase<mode> {
474471
public:
475472
explicit CompressionStreamImpl(kj::String format,
476-
Context::ContextFlags flags,
477-
kj::Arc<const jsg::ExternalMemoryTarget>&& externalMemoryTarget)
478-
: CompressionStreamBase<mode>(kj::mv(format), flags, kj::mv(externalMemoryTarget)) {}
479-
480-
protected:
481-
void requireActive(kj::StringPtr errorMessage) override {
482-
KJ_SWITCH_ONEOF(state) {
483-
KJ_CASE_ONEOF(ended, Ended) {
484-
JSG_FAIL_REQUIRE(Error, errorMessage);
485-
}
486-
KJ_CASE_ONEOF(exception, kj::Exception) {
487-
kj::throwFatalException(kj::cp(exception));
488-
}
489-
KJ_CASE_ONEOF(open, Open) {
490-
return;
491-
}
492-
}
493-
KJ_UNREACHABLE;
494-
}
495-
496-
void transitionToEnded() override {
497-
state = Ended();
498-
}
499-
500-
void transitionToErrored(kj::Exception&& reason) override {
501-
state = kj::mv(reason);
502-
}
503-
504-
void throwIfException() override {
505-
KJ_IF_SOME(exception, state.template tryGet<kj::Exception>()) {
506-
kj::throwFatalException(kj::cp(exception));
507-
}
508-
}
509-
510-
virtual bool isInTerminalState() override {
511-
// Ended or Exception are both terminal states.
512-
return state.template is<Ended>() || state.template is<kj::Exception>();
513-
}
514-
515-
private:
516-
struct Ended {};
517-
struct Open {};
518-
519-
kj::OneOf<Open, Ended, kj::Exception> state = Open();
520-
};
521-
522-
template <Context::Mode mode>
523-
class CompressionStreamImplV2 final: public CompressionStreamBase<mode> {
524-
public:
525-
explicit CompressionStreamImplV2(kj::String format,
526473
Context::ContextFlags flags,
527474
kj::Arc<const jsg::ExternalMemoryTarget>&& externalMemoryTarget)
528475
: CompressionStreamBase<mode>(kj::mv(format), flags, kj::mv(externalMemoryTarget)),
@@ -634,11 +581,6 @@ kj::Rc<CompressionStreamBase<Context::Mode::COMPRESS>> createCompressionStreamIm
634581
kj::String format,
635582
Context::ContextFlags flags,
636583
kj::Arc<const jsg::ExternalMemoryTarget>&& externalMemoryTarget) {
637-
// TODO(cleanup): Once the autogate is removed, we can delete CompressionStreamImpl
638-
if (util::Autogate::isEnabled(util::AutogateKey::COMPRESSION_STREAM_USE_STATE_MACHINE)) {
639-
return kj::rc<CompressionStreamImplV2<Context::Mode::COMPRESS>>(
640-
kj::mv(format), flags, kj::mv(externalMemoryTarget));
641-
}
642584
return kj::rc<CompressionStreamImpl<Context::Mode::COMPRESS>>(
643585
kj::mv(format), flags, kj::mv(externalMemoryTarget));
644586
}
@@ -647,11 +589,6 @@ kj::Rc<CompressionStreamBase<Context::Mode::DECOMPRESS>> createDecompressionStre
647589
kj::String format,
648590
Context::ContextFlags flags,
649591
kj::Arc<const jsg::ExternalMemoryTarget>&& externalMemoryTarget) {
650-
// TODO(cleanup): Once the autogate is removed, we can delete CompressionStreamImpl
651-
if (util::Autogate::isEnabled(util::AutogateKey::COMPRESSION_STREAM_USE_STATE_MACHINE)) {
652-
return kj::rc<CompressionStreamImplV2<Context::Mode::DECOMPRESS>>(
653-
kj::mv(format), flags, kj::mv(externalMemoryTarget));
654-
}
655592
return kj::rc<CompressionStreamImpl<Context::Mode::DECOMPRESS>>(
656593
kj::mv(format), flags, kj::mv(externalMemoryTarget));
657594
}

src/workerd/util/autogate.c++

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ kj::StringPtr KJ_STRINGIFY(AutogateKey key) {
2929
return "fetch-request-memory-adjustment"_kj;
3030
case AutogateKey::RUST_BACKED_NODE_DNS:
3131
return "rust-backed-node-dns"_kj;
32-
case AutogateKey::COMPRESSION_STREAM_USE_STATE_MACHINE:
33-
return "compression-stream-use-state-machine"_kj;
3432
case AutogateKey::IDENTITY_TRANSFORM_STREAM_USE_STATE_MACHINE:
3533
return "identity-transform-stream-use-state-machine"_kj;
3634
case AutogateKey::RPC_USE_EXTERNAL_PUSHER:

src/workerd/util/autogate.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ enum class AutogateKey {
2424
FETCH_REQUEST_MEMORY_ADJUSTMENT,
2525
// Enable Rust-backed Node.js DNS implementation
2626
RUST_BACKED_NODE_DNS,
27-
// Switch the CompressionStream to use the new state machine-based impl
28-
COMPRESSION_STREAM_USE_STATE_MACHINE,
2927
// Switch the IdentityTransformStream to use the new state machine-based impl
3028
IDENTITY_TRANSFORM_STREAM_USE_STATE_MACHINE,
3129
// Use ExternalPusher instead of StreamSink to handle streams in RPC.

0 commit comments

Comments
 (0)