Skip to content

Commit b3091dc

Browse files
committed
fix: configure runner config per runner name
1 parent c376b93 commit b3091dc

File tree

30 files changed

+534
-580
lines changed

30 files changed

+534
-580
lines changed

Cargo.lock

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

out/openapi.json

Lines changed: 1 addition & 132 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/common/types/src/keys/pegboard/ns.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use udb_util::prelude::*;
77
#[derive(Debug)]
88
pub struct OutboundDesiredSlotsKey {
99
pub namespace_id: Id,
10-
pub runner_name_selector: String,
10+
pub runner_name: String,
1111
}
1212

1313
impl OutboundDesiredSlotsKey {
14-
pub fn new(namespace_id: Id, runner_name_selector: String) -> Self {
14+
pub fn new(namespace_id: Id, runner_name: String) -> Self {
1515
OutboundDesiredSlotsKey {
1616
namespace_id,
17-
runner_name_selector,
17+
runner_name,
1818
}
1919
}
2020

@@ -53,20 +53,20 @@ impl TuplePack for OutboundDesiredSlotsKey {
5353
OUTBOUND,
5454
DESIRED_SLOTS,
5555
self.namespace_id,
56-
&self.runner_name_selector,
56+
&self.runner_name,
5757
);
5858
t.pack(w, tuple_depth)
5959
}
6060
}
6161

6262
impl<'de> TupleUnpack<'de> for OutboundDesiredSlotsKey {
6363
fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
64-
let (input, (_, _, _, namespace_id, runner_name_selector)) =
64+
let (input, (_, _, _, namespace_id, runner_name)) =
6565
<(usize, usize, usize, Id, String)>::unpack(input, tuple_depth)?;
6666

6767
let v = OutboundDesiredSlotsKey {
6868
namespace_id,
69-
runner_name_selector,
69+
runner_name,
7070
};
7171

7272
Ok((input, v))

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,4 @@ define_keys! {
121121
(93, INSTANCE_BALLOT, "instance_ballot"),
122122
(94, OUTBOUND, "outbound"),
123123
(95, DESIRED_SLOTS, "desired_slots"),
124-
(96, RUNNER_KIND, "runner_kind"),
125124
}

packages/common/universalpubsub/src/driver/memory/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::time::Duration;
44

55
use anyhow::*;
66
use async_trait::async_trait;
7-
use tokio::sync::{mpsc, RwLock};
7+
use tokio::sync::{RwLock, mpsc};
88
use uuid::Uuid;
99

1010
use crate::driver::{PubSubDriver, SubscriberDriver, SubscriberDriverHandle};

packages/core/api-peer/src/internal.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use anyhow::Result;
22
use gas::prelude::*;
33
use rivet_api_builder::ApiCtx;
4-
use rivet_util::Id;
54
use serde::{Deserialize, Serialize};
65

76
#[derive(Serialize, Deserialize)]

packages/core/api-peer/src/namespaces.rs

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub async fn get(ctx: ApiCtx, path: GetPath, _query: GetQuery) -> Result<GetResp
2929
namespace_ids: vec![path.namespace_id],
3030
})
3131
.await?
32-
.namespaces
3332
.into_iter()
3433
.next()
3534
.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?;
@@ -188,69 +187,68 @@ pub async fn create(
188187
namespace_ids: vec![namespace_id],
189188
})
190189
.await?
191-
.namespaces
192190
.into_iter()
193191
.next()
194192
.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?;
195193

196194
Ok(CreateResponse { namespace })
197195
}
198196

199-
#[derive(Debug, Serialize, Deserialize, IntoParams)]
200-
#[serde(deny_unknown_fields)]
201-
#[into_params(parameter_in = Query)]
202-
pub struct UpdateQuery {}
203-
204-
#[derive(Deserialize)]
205-
#[serde(deny_unknown_fields)]
206-
pub struct UpdatePath {
207-
pub namespace_id: Id,
208-
}
209-
210-
#[derive(Deserialize, Serialize, ToSchema)]
211-
#[serde(deny_unknown_fields)]
212-
#[schema(as = NamespacesUpdateRequest)]
213-
pub struct UpdateRequest(namespace::workflows::namespace::Update);
214-
215-
#[derive(Serialize, ToSchema)]
216-
#[schema(as = NamespacesUpdateResponse)]
217-
pub struct UpdateResponse {}
218-
219-
pub async fn update(
220-
ctx: ApiCtx,
221-
path: UpdatePath,
222-
_query: UpdateQuery,
223-
body: UpdateRequest,
224-
) -> Result<UpdateResponse> {
225-
let mut sub = ctx
226-
.subscribe::<namespace::workflows::namespace::UpdateResult>((
227-
"namespace_id",
228-
path.namespace_id,
229-
))
230-
.await?;
231-
232-
let res = ctx
233-
.signal(body.0)
234-
.to_workflow::<namespace::workflows::namespace::Workflow>()
235-
.tag("namespace_id", path.namespace_id)
236-
.send()
237-
.await;
238-
239-
if let Some(WorkflowError::WorkflowNotFound) = res
240-
.as_ref()
241-
.err()
242-
.and_then(|x| x.chain().find_map(|x| x.downcast_ref::<WorkflowError>()))
243-
{
244-
return Err(namespace::errors::Namespace::NotFound.build());
245-
} else {
246-
res?;
247-
}
248-
249-
sub.next()
250-
.await?
251-
.into_body()
252-
.res
253-
.map_err(|err| err.build())?;
254-
255-
Ok(UpdateResponse {})
256-
}
197+
// #[derive(Debug, Serialize, Deserialize, IntoParams)]
198+
// #[serde(deny_unknown_fields)]
199+
// #[into_params(parameter_in = Query)]
200+
// pub struct UpdateQuery {}
201+
202+
// #[derive(Deserialize)]
203+
// #[serde(deny_unknown_fields)]
204+
// pub struct UpdatePath {
205+
// pub namespace_id: Id,
206+
// }
207+
208+
// #[derive(Deserialize, Serialize, ToSchema)]
209+
// #[serde(deny_unknown_fields)]
210+
// #[schema(as = NamespacesUpdateRequest)]
211+
// pub struct UpdateRequest(namespace::workflows::namespace::Update);
212+
213+
// #[derive(Serialize, ToSchema)]
214+
// #[schema(as = NamespacesUpdateResponse)]
215+
// pub struct UpdateResponse {}
216+
217+
// pub async fn update(
218+
// ctx: ApiCtx,
219+
// path: UpdatePath,
220+
// _query: UpdateQuery,
221+
// body: UpdateRequest,
222+
// ) -> Result<UpdateResponse> {
223+
// let mut sub = ctx
224+
// .subscribe::<namespace::workflows::namespace::UpdateResult>((
225+
// "namespace_id",
226+
// path.namespace_id,
227+
// ))
228+
// .await?;
229+
230+
// let res = ctx
231+
// .signal(body.0)
232+
// .to_workflow::<namespace::workflows::namespace::Workflow>()
233+
// .tag("namespace_id", path.namespace_id)
234+
// .send()
235+
// .await;
236+
237+
// if let Some(WorkflowError::WorkflowNotFound) = res
238+
// .as_ref()
239+
// .err()
240+
// .and_then(|x| x.chain().find_map(|x| x.downcast_ref::<WorkflowError>()))
241+
// {
242+
// return Err(namespace::errors::Namespace::NotFound.build());
243+
// } else {
244+
// res?;
245+
// }
246+
247+
// sub.next()
248+
// .await?
249+
// .into_body()
250+
// .res
251+
// .map_err(|err| err.build())?;
252+
253+
// Ok(UpdateResponse {})
254+
// }

packages/core/api-peer/src/router.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ pub async fn router(
1414
.route("/namespaces", get(namespaces::list))
1515
.route("/namespaces", post(namespaces::create))
1616
.route("/namespaces/{namespace_id}", get(namespaces::get))
17-
.route("/namespaces/{namespace_id}", put(namespaces::update))
1817
.route(
1918
"/namespaces/resolve/{name}",
2019
get(namespaces::resolve_for_name),
2120
)
21+
// MARK: Runner configs
22+
// .route("/namespaces/{namespace_id}/runner-configs", get(namespaces::runner_configs::list))
23+
// .route("/namespaces/{namespace_id}/runner-configs/{runner_name}", put(namespaces::runner_configs::upsert))
24+
// .route("/namespaces/{namespace_id}/runner-configs/{runner_name}", get(namespaces::runner_configs::get))
25+
// .route("/namespaces/{namespace_id}/runner-configs/{runner_name}", delete(namespaces::runner_configs::delete))
2226
// MARK: Actors
2327
.route("/actors", get(actors::list::list))
2428
.route("/actors", post(actors::create::create))
@@ -31,6 +35,7 @@ pub async fn router(
3135
.route("/runners/names", get(runners::list_names))
3236
// MARK: Internal
3337
.route("/cache/purge", post(internal::cache_purge))
38+
// .route("/bump-autoscaler", post(internal::bump_autoscaler))
3439
})
3540
.await
3641
}

0 commit comments

Comments
 (0)