@@ -53,11 +53,11 @@ kj::Own<WorkerInterface> GlobalActorOutgoingFactory::newSingleUseClient(
5353 KJ_SWITCH_ONEOF (channelIdOrFactory) {
5454 KJ_CASE_ONEOF (channelId, uint) {
5555 actorChannel = context.getGlobalActorChannel (channelId, id->getInner (),
56- kj::mv (locationHint), mode, enableReplicaRouting, tracing.span );
56+ kj::mv (locationHint), mode, enableReplicaRouting, kj::mv (routingMode), tracing.span );
5757 }
5858 KJ_CASE_ONEOF (factory, kj::Own<DurableObjectNamespace::ActorChannelFactory>) {
59- actorChannel = factory->getGlobalActor (
60- id-> getInner () , kj::mv (locationHint), mode, enableReplicaRouting , tracing.span );
59+ actorChannel = factory->getGlobalActor (id-> getInner (), kj::mv (locationHint), mode,
60+ enableReplicaRouting , kj::mv (routingMode) , tracing.span );
6161 }
6262 }
6363 }
@@ -146,24 +146,31 @@ jsg::Ref<DurableObject> DurableObjectNamespace::getImpl(jsg::Lock& js,
146146 jsg::Optional<GetDurableObjectOptions> options) {
147147 JSG_REQUIRE (idFactory->matchesJurisdiction (id->getInner ()), TypeError,
148148 " get called on jurisdictional subnamespace with an ID from a different jurisdiction" );
149+ KJ_IF_SOME (o, options) {
150+ KJ_IF_SOME (routingMode, o.routingMode ) {
151+ JSG_REQUIRE (routingMode == " primary-only" , RangeError, " unknown routingMode: " , routingMode);
152+ }
153+ }
149154
150155 auto & context = IoContext::current ();
151- kj::Maybe<kj::String> locationHint = kj::none;
156+ kj::Maybe<kj::String> locationHint;
157+ kj::Maybe<kj::String> routingMode;
152158 KJ_IF_SOME (o, options) {
153159 locationHint = kj::mv (o.locationHint );
160+ routingMode = kj::mv (o.routingMode );
154161 }
155162
156163 bool enableReplicaRouting = FeatureFlags::get (js).getReplicaRouting ();
157164
158165 kj::Own<Fetcher::OutgoingFactory> outgoingFactory;
159166 KJ_SWITCH_ONEOF (channel) {
160167 KJ_CASE_ONEOF (channelId, uint) {
161- outgoingFactory = kj::heap<GlobalActorOutgoingFactory>(
162- channelId, id. addRef (), kj::mv (locationHint), mode, enableReplicaRouting);
168+ outgoingFactory = kj::heap<GlobalActorOutgoingFactory>(channelId, id. addRef (),
169+ kj::mv (locationHint), mode, enableReplicaRouting, kj::mv (routingMode) );
163170 }
164171 KJ_CASE_ONEOF (channelFactory, IoOwn<ActorChannelFactory>) {
165172 outgoingFactory = kj::heap<GlobalActorOutgoingFactory>(kj::addRef (*channelFactory),
166- id.addRef (), kj::mv (locationHint), mode, enableReplicaRouting);
173+ id.addRef (), kj::mv (locationHint), mode, enableReplicaRouting, kj::mv (routingMode) );
167174 }
168175 }
169176
0 commit comments