Skip to content

Commit 36bef7e

Browse files
committed
chore: remove port name
1 parent 7d7900b commit 36bef7e

File tree

32 files changed

+80
-845
lines changed

32 files changed

+80
-845
lines changed

frontend/src/queries/actor-engine.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const createEngineActorContext = ({
1818
headers: {
1919
"x-rivet-actor": actorId,
2020
"x-rivet-target": "actor",
21-
"x-rivet-port": "main",
2221
...(token ? { authorization: `Bearer ${token}` } : {}),
2322
},
2423
};

out/openapi.json

Lines changed: 0 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/common/config/src/config/db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ impl Default for Database {
1919
}
2020

2121
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)]
22+
#[serde(deny_unknown_fields)]
2223
pub struct Postgres {
2324
/// URL to connect to Postgres with
2425
///
Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use gas::prelude::*;
2-
use rivet_data::generated::pegboard_runner_address_v1;
3-
use rivet_runner_protocol::protocol;
42
use rivet_util::Id;
53
use serde::{Deserialize, Serialize};
6-
use std::ops::Deref;
74
use utoipa::ToSchema;
85

96
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
@@ -17,9 +14,6 @@ pub struct Runner {
1714
pub version: u32,
1815
pub total_slots: u32,
1916
pub remaining_slots: u32,
20-
pub addresses_http: StringHttpAddressHashableMap,
21-
pub addresses_tcp: StringTcpAddressHashableMap,
22-
pub addresses_udp: StringUdpAddressHashableMap,
2317
pub create_ts: i64,
2418
pub drain_ts: Option<i64>,
2519
pub stop_ts: Option<i64>,
@@ -28,97 +22,3 @@ pub struct Runner {
2822
pub last_rtt: u32,
2923
pub metadata: Option<serde_json::Map<String, serde_json::Value>>,
3024
}
31-
32-
// HACK: We can't define ToSchema on HashableMap directly, so we have to define concrete types
33-
#[derive(Debug, Clone, Serialize, Deserialize)]
34-
pub struct StringHttpAddressHashableMap(
35-
util::serde::HashableMap<String, pegboard_runner_address_v1::Http>,
36-
);
37-
38-
impl From<util::serde::HashableMap<String, pegboard_runner_address_v1::Http>>
39-
for StringHttpAddressHashableMap
40-
{
41-
fn from(value: util::serde::HashableMap<String, pegboard_runner_address_v1::Http>) -> Self {
42-
Self(value)
43-
}
44-
}
45-
46-
impl Deref for StringHttpAddressHashableMap {
47-
type Target = util::serde::HashableMap<String, pegboard_runner_address_v1::Http>;
48-
49-
fn deref(&self) -> &Self::Target {
50-
&self.0
51-
}
52-
}
53-
54-
impl utoipa::ToSchema for StringHttpAddressHashableMap {}
55-
56-
impl utoipa::PartialSchema for StringHttpAddressHashableMap {
57-
fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
58-
utoipa::openapi::ObjectBuilder::new()
59-
.additional_properties(Some(protocol::RunnerAddressHttp::schema()))
60-
.into()
61-
}
62-
}
63-
64-
#[derive(Debug, Clone, Serialize, Deserialize)]
65-
pub struct StringTcpAddressHashableMap(
66-
util::serde::HashableMap<String, pegboard_runner_address_v1::Tcp>,
67-
);
68-
69-
impl From<util::serde::HashableMap<String, pegboard_runner_address_v1::Tcp>>
70-
for StringTcpAddressHashableMap
71-
{
72-
fn from(value: util::serde::HashableMap<String, pegboard_runner_address_v1::Tcp>) -> Self {
73-
Self(value)
74-
}
75-
}
76-
77-
impl Deref for StringTcpAddressHashableMap {
78-
type Target = util::serde::HashableMap<String, pegboard_runner_address_v1::Tcp>;
79-
80-
fn deref(&self) -> &Self::Target {
81-
&self.0
82-
}
83-
}
84-
85-
impl utoipa::ToSchema for StringTcpAddressHashableMap {}
86-
87-
impl utoipa::PartialSchema for StringTcpAddressHashableMap {
88-
fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
89-
utoipa::openapi::ObjectBuilder::new()
90-
.additional_properties(Some(protocol::RunnerAddressTcp::schema()))
91-
.into()
92-
}
93-
}
94-
95-
#[derive(Debug, Clone, Serialize, Deserialize)]
96-
pub struct StringUdpAddressHashableMap(
97-
util::serde::HashableMap<String, pegboard_runner_address_v1::Udp>,
98-
);
99-
100-
impl From<util::serde::HashableMap<String, pegboard_runner_address_v1::Udp>>
101-
for StringUdpAddressHashableMap
102-
{
103-
fn from(value: util::serde::HashableMap<String, pegboard_runner_address_v1::Udp>) -> Self {
104-
Self(value)
105-
}
106-
}
107-
108-
impl Deref for StringUdpAddressHashableMap {
109-
type Target = util::serde::HashableMap<String, pegboard_runner_address_v1::Udp>;
110-
111-
fn deref(&self) -> &Self::Target {
112-
&self.0
113-
}
114-
}
115-
116-
impl utoipa::ToSchema for StringUdpAddressHashableMap {}
117-
118-
impl utoipa::PartialSchema for StringUdpAddressHashableMap {
119-
fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
120-
utoipa::openapi::ObjectBuilder::new()
121-
.additional_properties(Some(protocol::RunnerAddressUdp::schema()))
122-
.into()
123-
}
124-
}

packages/common/udb-util/src/keys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ define_keys! {
6565
(37, TOTAL_MEMORY, "total_memory"),
6666
(38, TOTAL_CPU, "total_cpu"),
6767
(39, NAMESPACE, "namespace"),
68-
(40, ADDRESS, "address"),
68+
// 40
6969
(41, DISPLAY_NAME, "display_name"),
7070
(42, CONNECTABLE, "connectable"),
7171
(43, SLEEP_TS, "sleep_ts"),

packages/core/guard/server/src/cache/actor.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
use anyhow::Result;
77
use gas::prelude::*;
88

9-
use crate::routing::pegboard_gateway::{X_RIVET_ACTOR, X_RIVET_PORT};
9+
use crate::routing::pegboard_gateway::X_RIVET_ACTOR;
1010

1111
#[tracing::instrument(skip_all)]
1212
pub fn build_cache_key(target: &str, path: &str, headers: &hyper::HeaderMap) -> Result<u64> {
@@ -22,19 +22,10 @@ pub fn build_cache_key(target: &str, path: &str, headers: &hyper::HeaderMap) ->
2222
})?;
2323
let actor_id = Id::parse(actor_id_str.to_str()?)?;
2424

25-
let port_name = headers.get(X_RIVET_PORT).ok_or_else(|| {
26-
crate::errors::MissingHeader {
27-
header: X_RIVET_PORT.to_string(),
28-
}
29-
.build()
30-
})?;
31-
let port_name = port_name.to_str()?;
32-
33-
// Create a hash using target, actor_id and port_name
25+
// Create a hash using target, actor_id, and path
3426
let mut hasher = DefaultHasher::new();
3527
target.hash(&mut hasher);
3628
actor_id.hash(&mut hasher);
37-
port_name.hash(&mut hasher);
3829
path.hash(&mut hasher);
3930
let hash = hasher.finish();
4031

packages/core/guard/server/src/errors.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ pub struct WrongAddrProtocol {
4343
"guard",
4444
"actor_not_found",
4545
"Actor not found.",
46-
"Actor with ID {actor_id} and port {port_name} not found."
46+
"Actor with ID {actor_id} not found."
4747
)]
4848
pub struct ActorNotFound {
4949
pub actor_id: Id,
50-
pub port_name: String,
5150
}
5251

5352
#[derive(RivetError, Serialize)]

packages/core/guard/server/src/routing/pegboard_gateway.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::{errors, shared_state::SharedState};
1010

1111
const ACTOR_READY_TIMEOUT: Duration = Duration::from_secs(10);
1212
pub const X_RIVET_ACTOR: HeaderName = HeaderName::from_static("x-rivet-actor");
13-
pub const X_RIVET_PORT: HeaderName = HeaderName::from_static("x-rivet-port");
1413

1514
/// Route requests to actor services based on hostname and path
1615
#[tracing::instrument(skip_all)]
@@ -65,16 +64,8 @@ pub async fn route_request(
6564
})));
6665
}
6766

68-
let port_name = headers.get(X_RIVET_PORT).ok_or_else(|| {
69-
crate::errors::MissingHeader {
70-
header: X_RIVET_PORT.to_string(),
71-
}
72-
.build()
73-
})?;
74-
let port_name = port_name.to_str()?;
75-
7667
// Lookup actor
77-
find_actor(ctx, shared_state, actor_id, port_name, path).await
68+
find_actor(ctx, shared_state, actor_id, path).await
7869
}
7970

8071
struct FoundActor {
@@ -83,13 +74,12 @@ struct FoundActor {
8374
destroyed: bool,
8475
}
8576

86-
/// Find an actor by actor_id and port_name
87-
#[tracing::instrument(skip_all, fields(%actor_id, %port_name, %path))]
77+
/// Find an actor by actor_id
78+
#[tracing::instrument(skip_all, fields(%actor_id, %path))]
8879
async fn find_actor(
8980
ctx: &StandaloneCtx,
9081
shared_state: &SharedState,
9182
actor_id: Id,
92-
port_name: &str,
9383
path: &str,
9484
) -> Result<Option<RoutingOutput>> {
9585
// TODO: Optimize this down to a single FDB call
@@ -136,11 +126,7 @@ async fn find_actor(
136126
.await??;
137127

138128
let Some(actor) = actor_res else {
139-
return Err(errors::ActorNotFound {
140-
actor_id,
141-
port_name: port_name.to_string(),
142-
}
143-
.build());
129+
return Err(errors::ActorNotFound { actor_id }.build());
144130
};
145131

146132
if actor.destroyed {
@@ -187,6 +173,7 @@ async fn find_actor(
187173

188174
tracing::debug!(?actor_id, ?runner_id, "actor ready");
189175

176+
// TODO: Remove round trip, return key from get_runner op above
190177
// Get runner key from runner_id
191178
let runner_key = ctx
192179
.udb()?
@@ -204,7 +191,6 @@ async fn find_actor(
204191
shared_state.pegboard_gateway.clone(),
205192
actor_id,
206193
runner_key,
207-
port_name.to_string(),
208194
);
209195
Ok(Some(RoutingOutput::CustomServe(std::sync::Arc::new(
210196
gateway,

0 commit comments

Comments
 (0)